mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
fix "$-" expansion for posix option (re: 921bbcae
)
In the SHOPT_BASH code, the -o posix option was given a '\374' (0xFC, 252) single-letter option character. Reasons unclear. The 'set' builtin doesn't accept it. It can be omitted and the option still works. And it caused the "$-" expansion (listing active short-form options) to include that invalid high-bit character if the -o posix option is active, which is clearly wrong. src/cmd/ksh93/sh/args.c: optksh[], flagval[]: - Remove '\374' one-letter option equivalent for SH_POSIX. src/cmd/ksh93/tests/options.sh: - Add test verifying that '-o posix' does not affect "$-".
This commit is contained in:
parent
bec6556236
commit
3ede73aa33
2 changed files with 12 additions and 2 deletions
|
@ -531,4 +531,15 @@ print '. ./dotfile' > envfile
|
|||
print $'alias print=:\nprint foobar' > dotfile
|
||||
[[ $(ENV=/.$PWD/envfile $SHELL -i -c : 2>/dev/null) == foobar ]] && err_exit 'files source from profile does not process aliases correctly'
|
||||
|
||||
# ======
|
||||
# test that '-o posix' option (not having a letter) does not affect "$-" expansion
|
||||
(
|
||||
command set +o posix 2>/dev/null
|
||||
opt1=$-
|
||||
command set -o posix 2>/dev/null
|
||||
opt2=$-
|
||||
[[ $opt1 == "$opt2" ]]
|
||||
) || err_exit '-o posix option affects $- expansion'
|
||||
|
||||
# ======
|
||||
exit $((Errors<125?Errors:125))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue