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

View file

@ -17,8 +17,8 @@
#include <releaseflags.h>
#define SH_RELEASE_FORK "93u+m" /* only change if you develop a new ksh93 fork */
#define SH_RELEASE_SVER "1.0.0-rc.3" /* semantic version number: https://semver.org */
#define SH_RELEASE_DATE "2022-07-27" /* must be in this format for $((.sh.version)) */
#define SH_RELEASE_SVER "1.0.0-rc.4" /* semantic version number: https://semver.org */
#define SH_RELEASE_DATE "2022-07-28" /* must be in this format for $((.sh.version)) */
#define SH_RELEASE_CPYR "(c) 2020-2022 Contributors to ksh " SH_RELEASE_FORK
/* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */