From 95e4f0ecbcbe50a7d64e0347d590f62caaff53d5 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 27 Jun 2023 15:02:59 -0400 Subject: sbopkglint: note absolute symlinks outside the package. --- sbopkglint.d/05-basic-sanity.t.sh | 17 +++++++++++++++-- 1 file 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 '/*' -- cgit v1.2.3