diff options
Diffstat (limited to 'sbopkglint.d/05-basic-sanity.t.sh')
-rw-r--r-- | sbopkglint.d/05-basic-sanity.t.sh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sbopkglint.d/05-basic-sanity.t.sh b/sbopkglint.d/05-basic-sanity.t.sh index 612b107..3b98c74 100644 --- a/sbopkglint.d/05-basic-sanity.t.sh +++ b/sbopkglint.d/05-basic-sanity.t.sh @@ -112,10 +112,11 @@ for i in $baddirs; do fi done +# 20220414 bkw: don't complain about broken symlinks here, they get checked elsewhere. for i in $fileonlydirs; do [ -d "$i" ] || continue dir_ok "$i" || warn_badperms "$i" - badstuff="$( find -L "$i" -mindepth 1 -maxdepth 1 \! -type f )" + badstuff="$( find -L "$i" -mindepth 1 -maxdepth 1 \! \( -type l -o -type f \) )" [ -n "$badstuff" ] && warn "$i should only contain files, not:" && ls -ld $badstuff done @@ -151,8 +152,15 @@ for i in $badfiles; do [ -e "$i" ] && warn "forbidden file: $i" done +# 20220414 bkw: absolute symlinks used to be an error, but there are just +# too many packages that use them. so only flag them if they're broken links. abslinks="$( find . -type l -lname '/*' )" +[ -n "$abslinks" ] && for i in $abslinks; do + target="$( readlink $i | sed 's,^/*,,' )" + [ -e "$target" ] || brokenabslinks+="$i " +done + brokenlinks="$( find -L . -type l \! -lname '/*' )" -[ -n "$abslinks" ] && warn "package contains absolute symlinks (should be relative):" && ls -ld $abslinks -[ -n "$brokenlinks" ] && warn "package contains broken symlinks:" && ls -ld $brokenlinks +[ -n "$brokenabslinks" ] && warn "package contains broken absolute symlinks:" && ls -ld $brokenabslinks +[ -n "$brokenlinks" ] && warn "package contains broken relative symlinks:" && ls -ld $brokenlinks |