summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Etc/BUGS3
-rw-r--r--Src/utils.c2
-rw-r--r--Test/B13whence.ztst9
4 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index aa056bbd6..fea7b0f76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2020-03-25 Daniel Shahaf <d.s@daniel.shahaf.name>
+ * 45583/0008: Etc/BUGS, Src/utils.c, Test/B13whence.ztst:
+ Extend tests to prove that what remains of xsymlinks() handles
+ symlink loops gracefully.
+
* 45583/0007: Src/utils.c: Remove code that is now unreachable.
* 45583/0006: Src/utils.c: Don't use xsymlinks() in 'whence -s'.
diff --git a/Etc/BUGS b/Etc/BUGS
index 2501d59a7..8112299f5 100644
--- a/Etc/BUGS
+++ b/Etc/BUGS
@@ -29,6 +29,3 @@ skipped when STTY=... is set for that command
44007 - Martijn - exit in trap executes rest of function
See test case in Test/C03traps.ztst.
------------------------------------------------------------------------
-45282: xsymlinks() segfaults on symlink loops
-Fixed for some cases; need to audit remaining callers
-------------------------------------------------------------------------
diff --git a/Src/utils.c b/Src/utils.c
index 98dac6780..69885fed3 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -922,8 +922,6 @@ slashsplit(char *s)
/* expands .. or . expressions and one level of symlinks
*
* Puts the result in the global "xbuf"
- *
- * WARNING: This will segfault on symlink loops (thread: workers/45282)
*/
/**/
diff --git a/Test/B13whence.ztst b/Test/B13whence.ztst
index b22363980..ea0a4dae5 100644
--- a/Test/B13whence.ztst
+++ b/Test/B13whence.ztst
@@ -5,6 +5,9 @@
ln -s real step3
ln -s step3 step2
ln -s step2 step1
+ ln -s loop loop
+ ln -s flip flop
+ ln -s flop flip
touch real
chmod +x real
prefix=$PWD
@@ -20,3 +23,9 @@
0q:whence symlink resolution
>$prefix/step1 -> $prefix/step2 -> $prefix/step3 -> $prefix/real
>$prefix/step1 -> $prefix/real
+
+ (
+ path=( $PWD/whence.tmp $path )
+ whence -S flip || whence -S loop || whence -s flip || whence -s loop
+ )
+1:whence deals with symlink loops gracefully