aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbopkglint.d/05-basic-sanity.t.sh17
1 files changed, 15 insertions, 2 deletions
diff --git a/sbopkglint.d/05-basic-sanity.t.sh b/sbopkglint.d/05-basic-sanity.t.sh
index d62238a..04d5ef9 100644
--- a/sbopkglint.d/05-basic-sanity.t.sh
+++ b/sbopkglint.d/05-basic-sanity.t.sh
@@ -169,9 +169,17 @@ 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.
+# 20230627 bkw: note absolute symlinks outside the package. used in my own
+# smc build, for instance. up to the human to decide whether it's a problem.
find . -type l -lname '/*' | while read f; do
target="$( readlink "$f" | sed 's,^/*,,' )"
- [ -e "$target" ] || ls -bld "$f" > .badlinks.$$
+ if [ ! -e "$target" ]; then
+ if [ -e "/$target" ]; then
+ ls -bld "$f" > .outlinks.$$
+ else
+ ls -bld "$f" > .badlinks.$$
+ fi
+ fi
done
if [ -s .badlinks.$$ ]; then
@@ -179,7 +187,12 @@ if [ -s .badlinks.$$ ]; then
cat .badlinks.$$
fi
-rm -f .badlinks.$$
+if [ -s .outlinks.$$ ]; then
+ note "package contains symlinks outside the package (which is OK, if intentional):"
+ cat .outlinks.$$
+fi
+
+rm -f .badlinks.$$ .outlinks.$$
find_warnfiles "package contains broken relative symlinks:" \
-L . -type l \! -lname '/*'