diff --git a/bin/package b/bin/package index 1a8c3b56e..32b018889 100755 --- a/bin/package +++ b/bin/package @@ -3523,7 +3523,7 @@ results)set '' $target ;; test) # pass control to ksh 93u+m test script - capture "$PACKAGEROOT/bin/shtests" $args + capture "$SHELL" "$PACKAGEROOT/bin/shtests" $args ;; use) # finalize the environment diff --git a/src/cmd/INIT/package.sh b/src/cmd/INIT/package.sh index 1a8c3b56e..32b018889 100644 --- a/src/cmd/INIT/package.sh +++ b/src/cmd/INIT/package.sh @@ -3523,7 +3523,7 @@ results)set '' $target ;; test) # pass control to ksh 93u+m test script - capture "$PACKAGEROOT/bin/shtests" $args + capture "$SHELL" "$PACKAGEROOT/bin/shtests" $args ;; use) # finalize the environment diff --git a/src/cmd/ksh93/DESIGN b/src/cmd/ksh93/DESIGN index 022d6870e..32aecbadd 100644 --- a/src/cmd/ksh93/DESIGN +++ b/src/cmd/ksh93/DESIGN @@ -153,12 +153,10 @@ sh directory: 28. timers.c contains code for multiple event timeouts. 29. trestore contains the code for restoring the parse tree from the file created by tdump. - 30. userinit.c contains a dummy userinit() function. - This is now obsolete with the new version of sh_main(). - 31. waitevent.c contains the sh_waitnotify function so + 30. waitevent.c contains the sh_waitnotify function so that builtins can handle processing events when the shell is waiting for input or for process completion. - 32. xec.c is the main shell execution loop. + 31. xec.c is the main shell execution loop. edit directory: 1. completion.c contains code for command and file generation and diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index 3cc4eff60..f88829950 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -1610,12 +1610,10 @@ const char sh_optksh[] = "the first command line option(s).]" #endif "\fabc\f" -"?" -"[T?Enable implementation specific test code defined by mask.]#[mask]" "\n" "\n[arg ...]\n" "\n" -"[+EXIT STATUS?If \b\f?\f\b executes command, the exit status will be that " +"[+EXIT STATUS?If \b\f?\f\b executes commands, the exit status will be that " "of the last command executed. Otherwise, it will be one of " "the following:]{" "[+0?The script or command line to be executed consists entirely " diff --git a/src/cmd/ksh93/include/shell.h b/src/cmd/ksh93/include/shell.h index 7db872d12..ca7cf8265 100644 --- a/src/cmd/ksh93/include/shell.h +++ b/src/cmd/ksh93/include/shell.h @@ -377,7 +377,6 @@ struct Shell_s Dt_t *typedict; Dt_t *inpool; char ifstable[256]; - unsigned long test; Shopt_t offoptions; /* options that were explicitly disabled by the user on the command line */ Shopt_t glob_options; Namval_t *typeinit; diff --git a/src/cmd/ksh93/sh/args.c b/src/cmd/ksh93/sh/args.c index ec1c3a0ed..29aeb43a9 100644 --- a/src/cmd/ksh93/sh/args.c +++ b/src/cmd/ksh93/sh/args.c @@ -187,12 +187,6 @@ int sh_argopts(int argc,register char *argv[]) case 'D': on_option(&newflags,SH_NOEXEC); goto skip; - case 'T': - if (opt_info.num) - sh.test |= opt_info.num; - else - sh.test = 0; - continue; case 's': if(setflag) { diff --git a/src/cmd/ksh93/sh/name.c b/src/cmd/ksh93/sh/name.c index 57d7b02d1..b04f66f55 100644 --- a/src/cmd/ksh93/sh/name.c +++ b/src/cmd/ksh93/sh/name.c @@ -2435,8 +2435,6 @@ static void table_unset(register Dt_t *root, int flags, Dt_t *oroot) Sfdouble_t d = nv_getnum(nq); nv_putval(nq,(char*)&d,NV_LDOUBLE); } - else if(sh.test&4) - nv_putval(nq, sh_strdup(nv_getval(nq)), NV_RDONLY); else nv_putval(nq, nv_getval(nq), NV_RDONLY); sh.subshell = subshell; diff --git a/src/cmd/ksh93/shell.3 b/src/cmd/ksh93/shell.3 index 8fdf549df..b10dd5e83 100644 --- a/src/cmd/ksh93/shell.3 +++ b/src/cmd/ksh93/shell.3 @@ -128,7 +128,7 @@ for example \f3tksh\fP(1). In this case, the user writes a \f3main()\fP function that calls \f3sh_main()\fP with the \fIargc\fP and \fIargv\fP arguments from \f3main\fP and pointer to function, \fIfn\fP as a third -argument.. The function \fIfn\fP will +argument. The function \fIfn\fP will be invoked with argument \f30\fP after \f3ksh\fP has done initialization, but before \f3ksh\fP has processed any start up files or executed any commands. The function \fIfn\fP diff --git a/src/cmd/ksh93/tests/basic.sh b/src/cmd/ksh93/tests/basic.sh index 93783cd39..ac62a368e 100755 --- a/src/cmd/ksh93/tests/basic.sh +++ b/src/cmd/ksh93/tests/basic.sh @@ -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)) diff --git a/src/cmd/ksh93/tests/builtins.sh b/src/cmd/ksh93/tests/builtins.sh index ab7d69aea..d9757e155 100755 --- a/src/cmd/ksh93/tests/builtins.sh +++ b/src/cmd/ksh93/tests/builtins.sh @@ -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"))" diff --git a/src/cmd/ksh93/tests/path.sh b/src/cmd/ksh93/tests/path.sh index b97245011..840df5afc 100755 --- a/src/cmd/ksh93/tests/path.sh +++ b/src/cmd/ksh93/tests/path.sh @@ -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" \ diff --git a/src/lib/libast/features/standards b/src/lib/libast/features/standards index 4a595748d..bcc2b167c 100644 --- a/src/lib/libast/features/standards +++ b/src/lib/libast/features/standards @@ -155,8 +155,12 @@ elif tst note{ GNU (glibc) or Cygwin }end compile{ return 0; } }end { + #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 + #endif + #ifndef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 + #endif #define basename basename /* avoid string.h defining this in conflict with AST basename(3) */ } elif tst note{ _ALL_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{ diff --git a/src/lib/libast/sfio/sfhdr.h b/src/lib/libast/sfio/sfhdr.h index a62511452..5a5c94a7c 100644 --- a/src/lib/libast/sfio/sfhdr.h +++ b/src/lib/libast/sfio/sfhdr.h @@ -433,7 +433,7 @@ #define SECOND 1000 /* millisecond units */ -/* macros do determine stream types from 'struct stat' data */ +/* macros to determine stream types from 'struct stat' data */ #ifndef S_IFDIR #define S_IFDIR 0 #endif