Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
4 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters