diff --git a/NEWS b/NEWS index c610179c5..4d0a889a8 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,12 @@ For full details, see the git log at: https://github.com/ksh93/ksh Any uppercase BUG_* names are modernish shell bug IDs. +2021-11-24: + +- The --posix mode was amended to stop the '.' command (but not 'source') from + looking up functions defined with the 'function' keyword. In the POSIX + standard and on other shells, the '.' command finds only script files. + 2021-11-23: - A bug was fixed that allowed arithmetic expressions to assign out-of-range diff --git a/src/cmd/ksh93/bltins/misc.c b/src/cmd/ksh93/bltins/misc.c index 799422187..947be740b 100644 --- a/src/cmd/ksh93/bltins/misc.c +++ b/src/cmd/ksh93/bltins/misc.c @@ -259,7 +259,7 @@ int b_dot_cmd(register int n,char *argv[],Shbltin_t *context) { /* check for KornShell style function first */ np = nv_search(script,shp->fun_tree,0); - if(np && is_afunction(np) && !nv_isattr(np,NV_FPOSIX)) + if(np && is_afunction(np) && !nv_isattr(np,NV_FPOSIX) && !(sh_isoption(SH_POSIX) && shp->bltindata.bnode==SYSDOT)) { if(!np->nvalue.ip) { diff --git a/src/cmd/ksh93/include/version.h b/src/cmd/ksh93/include/version.h index 010a2bd13..0e2c2e651 100644 --- a/src/cmd/ksh93/include/version.h +++ b/src/cmd/ksh93/include/version.h @@ -21,7 +21,7 @@ #define SH_RELEASE_FORK "93u+m" /* only change if you develop a new ksh93 fork */ #define SH_RELEASE_SVER "1.0.0-beta.2" /* semantic version number: https://semver.org */ -#define SH_RELEASE_DATE "2021-11-23" /* must be in this format for $((.sh.version)) */ +#define SH_RELEASE_DATE "2021-11-24" /* must be in this format for $((.sh.version)) */ #define SH_RELEASE_CPYR "(c) 2020-2021 Contributors to ksh " SH_RELEASE_FORK /* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */ diff --git a/src/cmd/ksh93/sh.1 b/src/cmd/ksh93/sh.1 index f1453c280..76ed98501 100644 --- a/src/cmd/ksh93/sh.1 +++ b/src/cmd/ksh93/sh.1 @@ -7246,6 +7246,9 @@ enables the recognition of a leading zero as introducing an octal number in all arithmetic evaluation contexts, except in the \fBlet\fR built-in while \fBletoctal\fR is off; .IP \[bu] +stops the \fB.\fR command (but not \fBsource\fR) from looking up functions +defined with the \fBfunction\fR syntax; +.IP \[bu] changes the \fBtest\fR/\fB[\fR built-in command to make its deprecated \fIexpr1\fR \fB-a\fR \fIexpr2\fR and \fIexpr1\fR \fB-o\fR \fIexpr2\fR operators work even if \fIexpr1\fR equals "\fB!\fR" or "\fb(\fR" (which means the diff --git a/src/cmd/ksh93/tests/path.sh b/src/cmd/ksh93/tests/path.sh index 3f36f72df..fc39600fc 100755 --- a/src/cmd/ksh93/tests/path.sh +++ b/src/cmd/ksh93/tests/path.sh @@ -903,5 +903,22 @@ got=$? [[ $exp == $got ]] || err_exit "Test 7E: exit status or error message for exec'd command with long name wrong" \ "(expected $exp, got $got)" +# ====== + +if [[ -o ?posix ]] +then ( + PATH=/dev/null + command set --posix + function dottest { :; } + . dottest + ) 2>/dev/null && err_exit "'.' in POSIX mode finds ksh function" + ( + PATH=/dev/null + command set --posix + function dottest { :; } + source dottest + ) 2>/dev/null || err_exit "'source' in POSIX mode does not find ksh function" +fi + # ====== exit $((Errors<125?Errors:125))