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

Fix handling of '--posix' and '--default' (#265)

src/cmd/ksh93/sh/args.c: sh_argopts():
- Remove special-casing for --posix (see also data/builtins.c) and
  move the case -5: to the case ':' instead, so this option is
  handled like all other long options. This change fixes two bugs:
  1. 'set --posix' had no effect on the letoctal or braceexpand
     options. Reproducer:
       $ set --posix
       $ [[ -o braceexpand ]]; echo $?
       0
       $ [[ -o letoctal ]]; echo $?
       1
  2. 'ksh --posix' could not run scripts correctly because it
     wrongly enabled '-c'. Reproducer:
       $ ksh --posix < <(echo 'exit 0')
       ksh: -c requires argument
       Usage: ksh [--posix] [arg ...]
       Help: ksh [ --help | --man ] 2>&1
- Don't allow 'set --default' to unset the restricted option.

src/cmd/ksh93/tests/options.sh:
- Add regression tests for the bugs described above, using -o posix
  and --posix.

src/cmd/ksh93/tests/restricted.sh:
- Add a regression test for 'set --default' in rksh.

Co-authored-by: Martijn Dekker <martijn@inlv.org>
This commit is contained in:
Johnothan King 2021-04-09 15:26:07 -07:00 committed by GitHub
parent cb67a01b45
commit 5461f11968
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 12 deletions

11
NEWS
View file

@ -3,6 +3,17 @@ For full details, see the git log at: https://github.com/ksh93/ksh
Any uppercase BUG_* names are modernish shell bug IDs.
2021-04-09:
- Fixed a bug that caused ksh to enable -c during the shell's initialization
if the only argument passed was --posix.
- Fixed a related bug that caused 'set --posix' to leave the braceexpand and
letoctal shell options unchanged.
- Fixed a bug that caused 'set --default' to unset the restricted option
in restricted shells.
2021-04-08:
- Path-bound builtins will now be used by restricted shells if /opt/ast/bin