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

Fix v=$(<file) for closed FD 0,1,2 (rhbz#1066589)

var=$(< file) now reads the file even if the standard inout,
standard output and/or standard error file descriptors are closed.

Original patch:
642af4d6/f/ksh-20120801-filecomsubst.patch

src/cmd/ksh93/sh/io.c: sh_redirect():
- When processing the '<' redirector as part of $(< ...), i.e. if
  flag==3, make sure the FD of the file to read is > 2 by calling
  sh_iomovefd(). Unlike the RedHat patch, this checks for flag==3
  to avoid unnecessary sh_iomovefd() calls for normal redirections,
  as there was no bug with those.

src/cmd/ksh93/tests/io.sh:
- Add test.
This commit is contained in:
Martijn Dekker 2020-09-22 02:45:59 +02:00
parent 5683155cb5
commit fe6d0903dc
3 changed files with 6 additions and 0 deletions

3
NEWS
View file

@ -9,6 +9,9 @@ Any uppercase BUG_* names are modernish shell bug IDs.
to lose the output of the commands they ran. This bug occurred when ksh was
compiled with the SHOPT_SPAWN compile-time option.
- Bugfix: var=$(< file) now reads the file even if the standard inout, standard
output and/or standard error file descriptors are closed.
2020-09-20:
- Bugfix: when whence -v/-a found an "undefined" (i.e. autoloadable) function