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

Make redirections like {varname}>file work with brace expansion off

This is some nonsense: redirections that store a file descriptor
greater than 9 in a variable, like {var}<&2 and the like, stopped
working if brace expansion was turned off. '{var}' is not a brace
expansion as it doesn't contain ',' or '..'; something like 'echo
{var}' is always output unexpanded. And redirections and brace
expansion are two completely unrelated things. It wasn't documented
that these redirections require the -B/braceexpand option, either.

src/cmd/ksh93/sh/lex.c: sh_lex():
- Remove incorrect check for braceexpand option before processing
  redirections of this form.

src/cmd/ksh93/COMPATIBILITY:
- Insert a brief item mentioning this.

src/cmd/ksh93/sh.1:
- Correction: these redirections do not yield a file descriptor >
  10, but > 9, a.k.a. >= 10.
- Add a brief example showing how these redirections can be used.

src/cmd/ksh93/tests/io.sh:
- Add a quick regression test.
This commit is contained in:
Martijn Dekker 2021-02-05 03:42:10 +00:00
parent c709868572
commit f9427909dc
6 changed files with 38 additions and 17 deletions

7
NEWS
View file

@ -3,6 +3,13 @@ For full details, see the git log at: https://github.com/ksh93/ksh
Any uppercase BUG_* names are modernish shell bug IDs.
2021-02-05:
- Fixed a longstanding bug that caused redirections that store a file
descriptor > 10 in a variable, such as {var}>file, to stop working if
brace expansion (the -B or -o braceexpand option) was turned off. (Note
that '{var}' is not a brace expansion as it does not contain ',' or '..'.)
2021-02-04:
- Fixed ksh crashing if an autoloaded function tried to autoload itself.