aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbopkglint.d/05-basic-sanity.t.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/sbopkglint.d/05-basic-sanity.t.sh b/sbopkglint.d/05-basic-sanity.t.sh
index 22dc309..d62238a 100644
--- a/sbopkglint.d/05-basic-sanity.t.sh
+++ b/sbopkglint.d/05-basic-sanity.t.sh
@@ -169,16 +169,20 @@ 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 "
+find . -type l -lname '/*' | while read f; do
+ target="$( readlink "$f" | sed 's,^/*,,' )"
+ [ -e "$target" ] || ls -bld "$f" > .badlinks.$$
done
-brokenlinks="$( find -L . -type l \! -lname '/*' )"
+if [ -s .badlinks.$$ ]; then
+ warn "package contains broken absolute symlinks:"
+ cat .badlinks.$$
+fi
+
+rm -f .badlinks.$$
-[ -n "$brokenabslinks" ] && warn "package contains broken absolute symlinks:" && ls -ld $brokenabslinks
-[ -n "$brokenlinks" ] && warn "package contains broken relative symlinks:" && ls -ld $brokenlinks
+find_warnfiles "package contains broken relative symlinks:" \
+ -L . -type l \! -lname '/*'
# 20230320 bkw: empty directories. this isn't an error, just a note, and
# we ignore any empty dirs under /var because lots of packages need these.