1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Various minor cleanups and fixes

The more notable ones are:

src/lib/libast/features/standards:
- Do not redefine _GNU_SOURCE and _FILE_OFFSET_BITS if already
  defined from $CCFLAGS. Thanks to @hyanias for the heads-up.
  (re: 289dd46c)

src/cmd/ksh93/data/builtins.c,
src/cmd/ksh93/include/shell.h,
src/cmd/ksh93/sh/args.c,
src/cmd/ksh93/sh/name.c:
- Remove -T test code activation option. It was basically unused.
  The only thing it did was intentionally introduce a memory leak
  in table_unset() if the 4th bit in the option argument was set.
  A search in ast-open-history reveals a few more trivial test uses
  that were later deleted, but nothing interesting.

src/cmd/ksh93/tests/{basic,path}.sh:
- Skip a couple of tests on AIX avoid hangs, at least one of which
  is not ksh's fault. Thanks to @HansH111 for the report.

src/cmd/ksh93/tests/builtins.sh:
- Change one awk use to a more portable sed invocation to placate
  systems with ancient awk commands, such as AIX. (re: de795e1f)
This commit is contained in:
Martijn Dekker 2022-01-20 00:30:54 +00:00
parent 289dd46c05
commit 41829efa06
13 changed files with 36 additions and 35 deletions

View file

@ -833,24 +833,27 @@ done
# ksh2020 regression: https://github.com/att/ast/issues/1284
actual=$($SHELL --verson 2>&1)
actual_status=$?
expect='ksh: verson: bad option(s)'
expect=': verson: bad option(s)'
expect_status=2
[[ "$actual" == *${expect}* ]] || err_exit "failed to handle invalid flag" \
"(expected $(printf %q ${expect}*), got $(printf %q "$actual"))"
"(expected *$(printf %q "$expect")*, got $(printf %q "$actual"))"
[[ $actual_status == $expect_status ]] ||
err_exit "wrong exit status (expected '$expect_status', got '$actual_status')"
# ======
# Test for illegal seek error (ksh93v- regression)
# https://www.mail-archive.com/ast-users@lists.research.att.com/msg00816.html
if [[ $(uname -s) != SunOS ]] # Solaris 11.4 join(1) hangs on this test -- not ksh's fault
then
exp='1
2'
got="$(join <(printf '%d\n' 1 2) <(printf '%d\n' 1 2))"
[[ $exp == $got ]] || err_exit "pipeline fails with illegal seek error" \
"(expected $(printf %q "$exp"), got $(printf %q "$got"))"
fi # $(uname -s) != SunOS
case $(uname -s) in
AIX | SunOS)
# AIX and Solaris join(1) hang on this test -- not ksh's fault
;;
*)
exp=$'1\n2'
got=$(join <(printf '%d\n' 1 2) <(printf '%d\n' 1 2))
[[ $exp == "$got" ]] || err_exit "pipeline fails with illegal seek error" \
"(expected $(printf %q "$exp"), got $(printf %q "$got"))"
;;
esac
# ======
exit $((Errors<125?Errors:125))

View file

@ -31,7 +31,7 @@ if builtin getconf 2> /dev/null; then
# The -l option should convert all variable names to lowercase.
# https://github.com/att/ast/issues/1171
got=$(getconf -lq | awk '{ gsub(/=.*/, "") } /[[:upper:]]/ { print }')
got=$(getconf -lq | LC_ALL=C sed -n '/[A-Z].*=/p')
[[ -n $got ]] && err_exit "'getconf -l' doesn't convert all variable names to lowercase" \
"(got $(printf %q "$got"))"

View file

@ -795,10 +795,17 @@ PATH=$PWD:$PWD/cmddir $SHELL -c 'noexecute; exit $?'
got=$?
[[ $exp == $got ]] || err_exit "Test 3B: failed to run executable command after encountering non-executable command" \
"(expected $exp, got $got)"
PATH=$PWD:$PWD/cmddir $SHELL -ic 'noexecute; exit $?'
got=$?
[[ $exp == $got ]] || err_exit "Test 3C: failed to run executable command after encountering non-executable command" \
"(expected $exp, got $got)"
case $(uname -s) in
AIX)
# ksh -ic hangs on AIX
;;
*)
PATH=$PWD:$PWD/cmddir $SHELL -ic 'noexecute; exit $?'
got=$?
[[ $exp == $got ]] || err_exit "Test 3C: failed to run executable command after encountering non-executable command" \
"(expected $exp, got $got)"
;;
esac
PATH=$PWD:$PWD/cmddir $SHELL -c 'command -x noexecute; exit $?'
got=$?
[[ $exp == $got ]] || err_exit "Test 3D: failed to run executable command after encountering non-executable command" \