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

set --default: properly restore ksh IFS behaviour (re: 9e2a8c69)

Reproducer:

$ (IFS=$'\t\t'; val=$'\tone\t\ttwo\t'; set --posix; \
   set -- $val; echo $#; set --noposix; set -- $val; echo $#)
2
4   <== OK

$ (IFS=$'\t\t'; val=$'\tone\t\ttwo\t'; set --posix; \
   set -- $val; echo $#; set --default; set -- $val; echo $#)
2
2   <== bug

The output of the seconnd command line should be like the first.

When POSIX mode is turned off using 'set --noposix' (or 'set +o
posix'), sh.ifstable is invalidated as it needs to be repopulated
on the next field split to restore ksh-specific special handling of
a repeated $IFS whitespace character as non-whitespace. However,
when 'set --default' is used, this does not happen, which is a bug.

src/cmd/ksh93/sh/args.c: sh_argopts():
- While processing --default, when turning off SH_POSIX, call
  sh_invalidate_ifs() to invalidate sh.ifstable.
This commit is contained in:
Martijn Dekker 2022-05-28 00:02:46 +01:00
parent 83baa27ef9
commit 8f14514661
4 changed files with 16 additions and 1 deletions

6
NEWS
View file

@ -3,6 +3,12 @@ For full details, see the git log at: https://github.com/ksh93/ksh/tree/1.0
Any uppercase BUG_* names are modernish shell bug IDs.
2022-05-27:
- Fixed a bug introduced on 2022-03-05 where 'set --default', while turning
off the --posix option, did not re-enable the special handling of a repeated
$IFS whitespace character as non-whitespace.
2022-05-25:
- Fixed a bug introduced on 2021-02-20 that caused incorrect output for