1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 11:42:21 +00:00

Shorten command name used to test ENAMETOOLONG exit status (#333)

A change in FreeBSD 13 now causes extremely long command names to
exit with errno set to E2BIG if the name can't fit in the list of
arguments. This was causing the regression tests for ENAMETOOLONG
to fail on FreeBSD 13 because the exit status for these errors
differ (ENAMETOOLONG uses status 127 while E2BIG uses status 126).

src/cmd/ksh93/tests/path.sh:
- To fix the failing regression tests, the command name has been
  shortened to twice the length of NAME_MAX. This length is still
  long enough to trigger an ENAMETOOLONG error without causing an
  E2BIG failure on FreeBSD 13.

Fixes https://github.com/ksh93/ksh/issues/331
This commit is contained in:
Johnothan King 2021-11-10 16:58:32 -08:00 committed by Martijn Dekker
parent ca6299ec4b
commit 3a5752218d

View file

@ -879,7 +879,8 @@ got=$?
"(expected $exp, got $got)"
# Tests for attempting to use a command name that's too long.
long_cmd=$(awk -v ORS= 'BEGIN { for(i=0;i<500;i++) print "xxxxxxxxxx"; }')
name_max=$(builtin getconf 2>/dev/null; getconf NAME_MAX . 2>/dev/null || echo 255)
long_cmd="$(awk -v ORS= 'BEGIN { for(i=0;i<'$name_max';i++) print "xx"; }')"
exp=127
PATH=$PWD $SHELL -c "$long_cmd" > /dev/null 2>&1
got=$?