diff --git a/tests/ls/symlink-slash.sh b/tests/ls/symlink-slash.sh index b18d8e917..b02b4d889 100755 --- a/tests/ls/symlink-slash.sh +++ b/tests/ls/symlink-slash.sh @@ -1,5 +1,6 @@ #!/bin/sh -# Do dereference a symlink arg if its name is written with a trailing slash. +# Do dereference a symlink arg if its name is written with a trailing +# slash, or with a trailing '/.' (both denote the directory itself). # Copyright (C) 1999-2026 Free Software Foundation, Inc. @@ -27,4 +28,9 @@ set -- $(ls -l symlink/) # Prior to fileutils-4.0k, the following would have output '... symlink -> dir'. test "$*" = 'total 0' && : || fail=1 +# A path ending in '/.' refers to the directory itself, so it must be +# dereferenced and its (empty) contents listed, not the symlink shown. +set -- $(ls -l symlink/.) +test "$*" = 'total 0' && : || fail=1 + Exit $fail