mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
posix: block brace expansion of unquoted expansions (re: a14d17c0
)
Historically, ksh (including ksh88 and mksh) allow brace expansion not just on literal patterns but also on patterns resulting from unquoted variable expansions or command substitutions: $ a='{a,b}' ksh -c 'echo X{a,b} Y$a' Xa Xb Ya Yb Most people expect only the first (literal) pattern to be expanded, as in bash and zsh: $ a='{a,b}' bash -c 'echo X{a,b} Y$a' Xa Xb Y{a,b} The historic ksh behaviour is poorly documented and nearly unknown, violates the principle of least astonishment, and makes unquoted variable expansions even more unsafe. See discussion at: https://www.austingroupbugs.net/view.php?id=1193 https://github.com/ksh93/ksh/issues/140 Unfortunately, we cannot change it in default ksh without breaking backward compatibility. But we can at least fix it for the POSIX mode (which disables brace expansion by default but allows turning it back on), particularly as it looks like POSIX, if it decides to specify brace expansion in a future version of the standard, will disallow brace expansion on unquoted variable expansions. src/cmd/ksh93/sh/macro.c: endfield(): - When deciding whether to do brace expansion + globbing or only globbing, also check that we do not have POSIX mode and an unquoted variable expansion (mp->pattern==1).
This commit is contained in:
parent
7b8e7fbb49
commit
0602177646
5 changed files with 28 additions and 2 deletions
8
NEWS
8
NEWS
|
@ -3,6 +3,14 @@ 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-06-08:
|
||||
|
||||
- If -B/--braceexpand is turned on in --posix mode, it now only allows brace
|
||||
expansion on literal strings and not on the values of unquoted expansions.
|
||||
This behaviour is like bash and zsh, as well as compliant with a future
|
||||
version of the POSIX standard that may specify brace expansion:
|
||||
https://www.austingroupbugs.net/view.php?id=1193
|
||||
|
||||
2022-06-07:
|
||||
|
||||
- Fixed a bug in 'typeset' where compound variables could acquire a spurious
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue