1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-24 15:04:13 +00:00
cde/src/cmd/ksh93/sh
Martijn Dekker 045fe6a110 Fix: Closing a FD within a comsub broke output (rhbz#1116072)
Another Red Hat patch. "Prior to this update, the result of a
command substitution was lost if a file descriptor used for the
substitution was previously explicitly closed. With this update,
ksh no longer reuses file descriptors that were closed during the
execution of a command substitution. Now, command substitutions
work as expected in the described situation."

Prior discussion:
https://bugzilla.redhat.com/1116072

Original patch:
https://src.fedoraproject.org/rpms/ksh/blob/642af4d6/f/ksh-20140929-safefd.patch

src/cmd/ksh93/include/io.h,
src/cmd/ksh93/sh/io.c:
- Add sh_iosafefd() function to get a file descriptor that is not
  in use or otherwise occupied (including marked as closed).

src/cmd/ksh93/sh/subshell.c: sh_subshell():
- Use that function to obtain a safe FD upon restoring state when
  exiting a command substitution. I don't really know the how and
  why -- all that I/O magic is still beyond me and the code is
  uncommented as usual.

src/cmd/ksh93/tests/subshell.sh:
- Add regression test from the reproducer in the bug, reduced to
  the minimum necessary.
2020-09-27 04:46:24 +02:00
..
args.c Fix hang in comsubs (rhbz#1062296) (re: 970069a6) 2020-09-24 06:07:12 +02:00
arith.c -o posix: inverse-sync braceexpand; properly sync letoctal 2020-09-18 22:07:44 +02:00
array.c Fix several memory leaks related to arrays (rhbz#921455) 2020-09-15 07:47:38 +02:00
defs.c test/[: use a shell state bit (re: 7003aba4) 2020-08-30 05:33:59 +01:00
deparse.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
expand.c Remove legacy code for older libast versions 2020-09-04 02:31:39 +02:00
fault.c rm redundant getpid(2) syscalls (re: 9de65210) 2020-09-23 04:19:02 +02:00
fcin.c Fix parsing of multibyte characters 2020-06-12 01:45:17 +02:00
init.c combining alarm and IFS caused segfault (rhbz#1176670) 2020-09-27 03:03:48 +02:00
io.c Fix: Closing a FD within a comsub broke output (rhbz#1116072) 2020-09-27 04:46:24 +02:00
jobs.c rm redundant getpid(2) syscalls (re: 9de65210) 2020-09-23 04:19:02 +02:00
lex.c rm redundant getpid(2) syscalls (re: 9de65210) 2020-09-23 04:19:02 +02:00
macro.c Allow turning off brace expansion in comsubs (rhbz#1078698) 2020-09-24 08:21:37 +02:00
main.c Fix argv rewrite on invoking hashbangless script (rhbz#1047506) 2020-09-25 15:02:51 +02:00
name.c Fix typeset -l/-u crash on special vars (rhbz#1083713) 2020-09-24 03:03:29 +02:00
nvdisc.c '#if 0' cleanup 2020-08-30 04:51:20 +01:00
nvtree.c '#if 0' cleanup 2020-08-30 04:51:20 +01:00
nvtype.c '#if 0' cleanup 2020-08-30 04:51:20 +01:00
parse.c Fix 'command' expansion bug and POSIX compliance 2020-09-11 10:06:43 +02:00
path.c Fix $PWD breakage on fork; cd; exec (rhbz#1168611) 2020-09-26 23:00:05 +02:00
pmain.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
shcomp.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
streval.c silence macro redefinition warnings (re: 7003aba4) 2020-06-16 04:51:21 +02:00
string.c Fix garbled output from Ctrl+Alt+V (#135) 2020-09-25 03:37:22 +01:00
subshell.c Fix: Closing a FD within a comsub broke output (rhbz#1116072) 2020-09-27 04:46:24 +02:00
suid_exec.c rm redundant getpid(2) syscalls (re: 9de65210) 2020-09-23 04:19:02 +02:00
tdump.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
timers.c rm redundant getpid(2) syscalls (re: 9de65210) 2020-09-23 04:19:02 +02:00
trestore.c '#if 0' cleanup 2020-08-30 04:51:20 +01:00
waitevent.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
xec.c fix non-null pointer check (re: b7932e87) 2020-09-25 23:46:24 +02:00