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

Fix "$*" doing pattern matching if $IFS is wildcard (BUG_IFSGLOBS)

The bug is that "$*", and related expansions such as "${arr[*]}",
etc., do pattern matching if the first character of $IFS is a
wildcard. For example, the following:

    IFS=*
    set -- F ''
    case BUGFREE in
    BUG"$*")        echo bug ;;
    esac

outputs 'bug'. This bug can be reproduced in every other glob
pattern matching context as well, but not in pathname expansion.

src/cmd/ksh93/sh/macro.c: varsub():
- When joining fields into one for a "$*"-type expansion, check if
  a glob pattern matching operation follows (mp->pattern is set).
  If so, write a preceding backslash to escape the separator.

Resolves: https://github.com/ksh93/ksh/issues/489
Resolves: https://github.com/att/ast/issues/12
This commit is contained in:
Martijn Dekker 2022-07-28 22:04:18 +02:00
parent 441dcc0483
commit 9f6841c37e
4 changed files with 49 additions and 3 deletions

5
NEWS
View file

@ -3,6 +3,11 @@ 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-07-28:
- Fixed BUG_IFSGLOBS ("$*" does pattern matching if the first character of
$IFS is a wildcard).
2022-07-27:
- Fixed a bug introduced on 2022-02-08 where $PPID was incorrect when a script