45583/0008: Extend tests to prove that what remains of xsymlinks() handles symlink loops gracefully.

This commit is contained in:
Daniel Shahaf 2020-03-21 19:16:17 +00:00
parent dabfd1f1fb
commit fc286a7c11
4 changed files with 13 additions and 5 deletions

View file

@ -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'.

View file

@ -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
------------------------------------------------------------------------

View file

@ -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)
*/
/**/

View file

@ -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