mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +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
|
test) # pass control to ksh 93u+m test script
|
||||||
capture "$PACKAGEROOT/bin/shtests" $args
|
capture "$SHELL" "$PACKAGEROOT/bin/shtests" $args
|
||||||
;;
|
;;
|
||||||
|
|
||||||
use) # finalize the environment
|
use) # finalize the environment
|
||||||
|
|
|
@ -3523,7 +3523,7 @@ results)set '' $target
|
||||||
;;
|
;;
|
||||||
|
|
||||||
test) # pass control to ksh 93u+m test script
|
test) # pass control to ksh 93u+m test script
|
||||||
capture "$PACKAGEROOT/bin/shtests" $args
|
capture "$SHELL" "$PACKAGEROOT/bin/shtests" $args
|
||||||
;;
|
;;
|
||||||
|
|
||||||
use) # finalize the environment
|
use) # finalize the environment
|
||||||
|
|
|
@ -153,12 +153,10 @@ sh directory:
|
||||||
28. timers.c contains code for multiple event timeouts.
|
28. timers.c contains code for multiple event timeouts.
|
||||||
29. trestore contains the code for restoring the parse
|
29. trestore contains the code for restoring the parse
|
||||||
tree from the file created by tdump.
|
tree from the file created by tdump.
|
||||||
30. userinit.c contains a dummy userinit() function.
|
30. waitevent.c contains the sh_waitnotify function so
|
||||||
This is now obsolete with the new version of sh_main().
|
|
||||||
31. waitevent.c contains the sh_waitnotify function so
|
|
||||||
that builtins can handle processing events when the
|
that builtins can handle processing events when the
|
||||||
shell is waiting for input or for process completion.
|
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:
|
edit directory:
|
||||||
1. completion.c contains code for command and file generation and
|
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).]"
|
"the first command line option(s).]"
|
||||||
#endif
|
#endif
|
||||||
"\fabc\f"
|
"\fabc\f"
|
||||||
"?"
|
|
||||||
"[T?Enable implementation specific test code defined by mask.]#[mask]"
|
|
||||||
"\n"
|
"\n"
|
||||||
"\n[arg ...]\n"
|
"\n[arg ...]\n"
|
||||||
"\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 "
|
"of the last command executed. Otherwise, it will be one of "
|
||||||
"the following:]{"
|
"the following:]{"
|
||||||
"[+0?The script or command line to be executed consists entirely "
|
"[+0?The script or command line to be executed consists entirely "
|
||||||
|
|
|
@ -377,7 +377,6 @@ struct Shell_s
|
||||||
Dt_t *typedict;
|
Dt_t *typedict;
|
||||||
Dt_t *inpool;
|
Dt_t *inpool;
|
||||||
char ifstable[256];
|
char ifstable[256];
|
||||||
unsigned long test;
|
|
||||||
Shopt_t offoptions; /* options that were explicitly disabled by the user on the command line */
|
Shopt_t offoptions; /* options that were explicitly disabled by the user on the command line */
|
||||||
Shopt_t glob_options;
|
Shopt_t glob_options;
|
||||||
Namval_t *typeinit;
|
Namval_t *typeinit;
|
||||||
|
|
|
@ -187,12 +187,6 @@ int sh_argopts(int argc,register char *argv[])
|
||||||
case 'D':
|
case 'D':
|
||||||
on_option(&newflags,SH_NOEXEC);
|
on_option(&newflags,SH_NOEXEC);
|
||||||
goto skip;
|
goto skip;
|
||||||
case 'T':
|
|
||||||
if (opt_info.num)
|
|
||||||
sh.test |= opt_info.num;
|
|
||||||
else
|
|
||||||
sh.test = 0;
|
|
||||||
continue;
|
|
||||||
case 's':
|
case 's':
|
||||||
if(setflag)
|
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);
|
Sfdouble_t d = nv_getnum(nq);
|
||||||
nv_putval(nq,(char*)&d,NV_LDOUBLE);
|
nv_putval(nq,(char*)&d,NV_LDOUBLE);
|
||||||
}
|
}
|
||||||
else if(sh.test&4)
|
|
||||||
nv_putval(nq, sh_strdup(nv_getval(nq)), NV_RDONLY);
|
|
||||||
else
|
else
|
||||||
nv_putval(nq, nv_getval(nq), NV_RDONLY);
|
nv_putval(nq, nv_getval(nq), NV_RDONLY);
|
||||||
sh.subshell = subshell;
|
sh.subshell = subshell;
|
||||||
|
|
|
@ -128,7 +128,7 @@ for example \f3tksh\fP(1).
|
||||||
In this case, the user writes a \f3main()\fP function that
|
In this case, the user writes a \f3main()\fP function that
|
||||||
calls \f3sh_main()\fP with the \fIargc\fP and \fIargv\fP arguments
|
calls \f3sh_main()\fP with the \fIargc\fP and \fIargv\fP arguments
|
||||||
from \f3main\fP and pointer to function, \fIfn\fP as a third
|
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,
|
be invoked with argument \f30\fP after \f3ksh\fP has done initialization,
|
||||||
but before \f3ksh\fP has processed any start up files or executed
|
but before \f3ksh\fP has processed any start up files or executed
|
||||||
any commands. The function \fIfn\fP
|
any commands. The function \fIfn\fP
|
||||||
|
|
|
@ -833,24 +833,27 @@ done
|
||||||
# ksh2020 regression: https://github.com/att/ast/issues/1284
|
# ksh2020 regression: https://github.com/att/ast/issues/1284
|
||||||
actual=$($SHELL --verson 2>&1)
|
actual=$($SHELL --verson 2>&1)
|
||||||
actual_status=$?
|
actual_status=$?
|
||||||
expect='ksh: verson: bad option(s)'
|
expect=': verson: bad option(s)'
|
||||||
expect_status=2
|
expect_status=2
|
||||||
[[ "$actual" == *${expect}* ]] || err_exit "failed to handle invalid flag" \
|
[[ "$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 ]] ||
|
[[ $actual_status == $expect_status ]] ||
|
||||||
err_exit "wrong exit status (expected '$expect_status', got '$actual_status')"
|
err_exit "wrong exit status (expected '$expect_status', got '$actual_status')"
|
||||||
|
|
||||||
# ======
|
# ======
|
||||||
# Test for illegal seek error (ksh93v- regression)
|
# Test for illegal seek error (ksh93v- regression)
|
||||||
# https://www.mail-archive.com/ast-users@lists.research.att.com/msg00816.html
|
# 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
|
case $(uname -s) in
|
||||||
then
|
AIX | SunOS)
|
||||||
exp='1
|
# AIX and Solaris join(1) hang on this test -- not ksh's fault
|
||||||
2'
|
;;
|
||||||
got="$(join <(printf '%d\n' 1 2) <(printf '%d\n' 1 2))"
|
*)
|
||||||
[[ $exp == $got ]] || err_exit "pipeline fails with illegal seek error" \
|
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"))"
|
"(expected $(printf %q "$exp"), got $(printf %q "$got"))"
|
||||||
fi # $(uname -s) != SunOS
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# ======
|
# ======
|
||||||
exit $((Errors<125?Errors:125))
|
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.
|
# The -l option should convert all variable names to lowercase.
|
||||||
# https://github.com/att/ast/issues/1171
|
# 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" \
|
[[ -n $got ]] && err_exit "'getconf -l' doesn't convert all variable names to lowercase" \
|
||||||
"(got $(printf %q "$got"))"
|
"(got $(printf %q "$got"))"
|
||||||
|
|
||||||
|
|
|
@ -795,10 +795,17 @@ PATH=$PWD:$PWD/cmddir $SHELL -c 'noexecute; exit $?'
|
||||||
got=$?
|
got=$?
|
||||||
[[ $exp == $got ]] || err_exit "Test 3B: failed to run executable command after encountering non-executable command" \
|
[[ $exp == $got ]] || err_exit "Test 3B: failed to run executable command after encountering non-executable command" \
|
||||||
"(expected $exp, got $got)"
|
"(expected $exp, got $got)"
|
||||||
|
case $(uname -s) in
|
||||||
|
AIX)
|
||||||
|
# ksh -ic hangs on AIX
|
||||||
|
;;
|
||||||
|
*)
|
||||||
PATH=$PWD:$PWD/cmddir $SHELL -ic 'noexecute; exit $?'
|
PATH=$PWD:$PWD/cmddir $SHELL -ic 'noexecute; exit $?'
|
||||||
got=$?
|
got=$?
|
||||||
[[ $exp == $got ]] || err_exit "Test 3C: failed to run executable command after encountering non-executable command" \
|
[[ $exp == $got ]] || err_exit "Test 3C: failed to run executable command after encountering non-executable command" \
|
||||||
"(expected $exp, got $got)"
|
"(expected $exp, got $got)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
PATH=$PWD:$PWD/cmddir $SHELL -c 'command -x noexecute; exit $?'
|
PATH=$PWD:$PWD/cmddir $SHELL -c 'command -x noexecute; exit $?'
|
||||||
got=$?
|
got=$?
|
||||||
[[ $exp == $got ]] || err_exit "Test 3D: failed to run executable command after encountering non-executable command" \
|
[[ $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;
|
return 0;
|
||||||
}
|
}
|
||||||
}end {
|
}end {
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
|
#endif
|
||||||
|
#ifndef _FILE_OFFSET_BITS
|
||||||
#define _FILE_OFFSET_BITS 64
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
#endif
|
||||||
#define basename basename /* avoid string.h defining this in conflict with AST basename(3) */
|
#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{
|
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 */
|
#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
|
#ifndef S_IFDIR
|
||||||
#define S_IFDIR 0
|
#define S_IFDIR 0
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue