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

'.': disable ksh function lookup in POSIX mode

POSIXly, '.' loads only files, not functions.

This only applies to '.', not 'source' (which is not in POSIX).

src/cmd/ksh93/bltins/misc.c: b_source():
- For ksh function lookup, add an additional check that we're not
  in POSIX mode and running the '.' (SYSDOT) builtin.
This commit is contained in:
Martijn Dekker 2021-11-24 09:10:25 +01:00
parent c0334e32a1
commit 214308f81e
5 changed files with 28 additions and 2 deletions

View file

@ -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))