tests: pwd: ensure our getcwd fallback is tested

* tests/pwd/pwd-long.sh: Avoid the getcwd syscall,
to ensure our fallback getcwd code is exercised.
* NEWS: Mention the recent bug fix in pwd.
This commit is contained in:
Pádraig Brady committed 2026-02-17 00:41:50 +00:00
1 parent 41e5ae80b1
commit 8a0d9b889f
2 files changed
+15 -1

No files matched your search

+4
View File
@@ -7,6 +7,10 @@ GNU coreutils NEWS -*- outline -*-
'kill --help' now has links to valid anchors in the html manual.
[bug introduced in coreutils-9.10]
'pwd' on ancient systems will no longer overflow a buffer
when operating in deep paths longer than twice the system PATH_MAX.
[bug introduced in coreutils-9.6]
** New Features
'date --date' now parses dot delimited dd.mm.yy format common in Europe.
+11 -1
View File
@@ -19,6 +19,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ pwd
uses_strace_
require_readable_root_
require_perl_
@@ -26,9 +27,18 @@ require_perl_
ARGV_0=$0
export ARGV_0
# Disable the getcwd syscall if possible, so more of our code is exercised.
if strace -f -o /dev/null -e 'getcwd' -e fault=all:error=ENOSYS true; then
no_sys_getcwd() {
strace -f -o /dev/null -e 'getcwd' -e fault=all:error=ENOSYS "$@"
}
else
no_sys_getcwd() { "$@"; }
fi
# Don't use CuTmpdir here, since File::Temp's use of rmtree can't
# remove the deep tree we create.
$PERL -Tw -I"$abs_srcdir/tests" -MCuSkip -- - <<\EOF
no_sys_getcwd $PERL -Tw -I"$abs_srcdir/tests" -MCuSkip -- - <<\EOF
# Show that pwd works even when the length of the resulting
# directory name is longer than PATH_MAX.