1
0
mirror of https://git.savannah.gnu.org/git/coreutils.git synced 2026-10-24 02:08:57 +03:00

tests: readlink: add tests for the symbolic link infinite loop

* tests/readlink/rl-1.sh: Add tests for the 'readlink' invocations that
would cause an infinite loop before commit b66f3e4e2 (realpath: fix an
infinite loop when resolving symbolic links, 2026-09-25). Also test the
behavior without an option, which would not cause the infinite loop.
This commit is contained in:
Collin Funk
2026-09-29 20:39:02 -07:00
parent 0bbf12284a
commit 6f36b64689

View File

@@ -55,4 +55,24 @@ test -z "$v" || fail=1
v=$(returns_ 1 readlink missing) || fail=1
test -z "$v" || fail=1
# From coreutils 9.0 to 9.12, the following would loop until the
# system ran out of memory.
ln -s loop/a loop || framework_failure_
vm=$(get_min_ulimit_v_ readlink -f link1) && {
echo 'loop/a' >exp || framework_failure_
for opt in '' -f -e -m; do
if test -z "$opt"; then
exp=exp
exp_rc=0
else
exp=/dev/null
exp_rc=1
fi
(ulimit -v $(($vm+6000)) &&
returns_ $exp_rc timeout 10 readlink $opt loop >out 2>err) || fail=1
compare $exp out || fail=1
compare /dev/null err || fail=1
done
}
Exit $fail