mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 19:52:20 +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:
parent
289dd46c05
commit
41829efa06
13 changed files with 36 additions and 35 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 "
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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"))"
|
||||
|
||||
|
|
|
@ -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" \
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue