From 40d9fe3e036e8ac404d81bb2f90a353e67440e92 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 8 Nov 2026 22:41:00 +0100 Subject: [PATCH] tests: ls: check a too long file name is reported as "cannot access" * tests/ls/ls-misc.pl (name-too-long): New test. https://github.com/uutils/coreutils/pull/15699 Link: https://github.com/coreutils/coreutils/pull/456 --- tests/ls/ls-misc.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/ls/ls-misc.pl b/tests/ls/ls-misc.pl index 60b52c4fc..542ceed73 100755 --- a/tests/ls/ls-misc.pl +++ b/tests/ls/ls-misc.pl @@ -361,7 +361,17 @@ my @Tests = {ERR => "$prog: invalid --block-size argument '0'\n"}, {EXIT => 2}, ] } ('', '--si', '-h')), - ); + + # A file name component that is too long is reported like any other + # file that cannot be accessed. ERR_SUBST avoids false ENOENT failures + # where the long name might be allowed. + do { my $long = 'x' x 1000; + ['name-too-long', $long, + {ERR_SUBST=>"s/'$long':.*/'$long':/"}, + {ERR => "$prog: cannot access '$long':\n"}, + {EXIT => 2}, + ] }, + ); umask 022;