[RFC 1/3] [gdb-add-index.sh] Revert symlink fix (PR gdb/27614)

Tom de Vries tdevries@suse.de
Fri Oct 15 13:32:22 GMT 2021


I ran into:
...
$ checkbashisms ./gdb/contrib/gdb-add-index.sh
possible bashism in ./gdb/contrib/gdb-add-index.sh line 41 \
  ('command' with option other than -p):
    if ! command -v readlink >/dev/null 2>&1; then
...

The code was added in commit db1f6cd692c "[PR gdb/27614] gdb-add-index fails
on symlinks".

I this series, I try to fix the PR gdb/27614 in a different way, so:
- revert the fix, but
- leave the test-case.
---
 gdb/contrib/gdb-add-index.sh | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
index 734110caa3b..2ac3fddbf26 100755
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -37,34 +37,6 @@ fi
 
 file="$1"
 
-if test -L "$file"; then
-    if ! command -v readlink >/dev/null 2>&1; then
-	echo "$myname: 'readlink' missing.  Failed to follow symlink $1." 1>&2
-	exit 1
-    fi
-
-    # Count number of links followed in order to detect loops.
-    count=0
-    while test -L "$file"; do
-	target=$(readlink "$file")
-
-	case "$target" in
-	    /*)
-		file="$target"
-		;;
-	    *)
-		file="$(dirname "$file")/$target"
-		;;
-	esac
-
-	count="$((count + 1))"
-	if test "$count" -gt 10; then
-	    echo "$myname: Detected loop while following link $file"
-	    exit 1
-	fi
-    done
-fi
-
 if test ! -r "$file"; then
     echo "$myname: unable to access: $file" 1>&2
     exit 1

base-commit: f9ebf60b6ff54fddf7e34b1bd96775b62fb89a22
-- 
2.26.2



More information about the Gdb-patches mailing list