-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix command substitutions in here-docs (rhbz#994241, rhbz#1036802)
When ksh was compiled with SHOPT_SPAWN (the default), any command substitution embedded in a here-document returned an empty string. The bug was also present in 93u+ 2012-08-01 (although not in every case as some systems compile it without SHOPT_SPAWN). This fixes it by applying a slightly edited combination of two Red Hat patches (the second containing a fix for the first), which backport a new command substitution mechanism from the abandoned ksh 93v- beta version. The originals are: https://src.fedoraproject.org/rpms/ksh/blob/642af4d6/f/ksh-20120801-macro.patch https://src.fedoraproject.org/rpms/ksh/blob/642af4d6/f/ksh-20120801-fd2lost.patch src/cmd/ksh93/include/io.h: - The iopipe() function from xec.c is now needed in sh_subshell() (subshell.c), so rename it to sh_iounpipe() and declare it as an extern here. The 93v- beta did it as well. (The Red Hat patch did this without renaming it.) src/cmd/ksh93/sh/xec.c: - Backport new versions of iousepipe() and sh_iounpipe() from ksh 93v-. New 'type' flaggery is introduced to distinguish between different command substitution conditions. What all that means remains to be determined. - sh_exec(): I made one change to the Red Hat patch myself: if in a subshell and the type flags FAMP (for "ampersand" as in '&' as in background job) and TFORK are set, continue to call sh_subfork() to fork the subshell unconditionally, instead of only if we're in a command substitution connected to an unseekable file. Maybe the latter works for the 93v- code, but on 93u+(m) it causes a couple of regressions, which are fixed by my change: signal.sh[273]: subshell ignoring signal does not send signal to parent signal.sh[276]: subshell catching signal does not send signal to parent Details: #104 (comment) src/cmd/ksh93/sh/macro.c, src/cmd/ksh93/sh/subshell.c: - Updates that go with those new functions. Fixes: #104 Affects: #124
- Loading branch information
Showing
6 changed files
with
111 additions
and
30 deletions.
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
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