aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-06-27 15:02:59 -0400
committerB. Watson <urchlay@slackware.uk>2023-06-27 15:02:59 -0400
commit95e4f0ecbcbe50a7d64e0347d590f62caaff53d5 (patch)
treeae4da3b56ddd7fc7c0c6251660ec0670d81b72b7
parentf159c32799abf4371eae2d2d12fe3e74e4461f07 (diff)
downloadsbo-maintainer-tools-95e4f0ecbcbe50a7d64e0347d590f62caaff53d5.tar.gz
sbopkglint: note absolute symlinks outside the package.
-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 '/*'