-
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 hang in
comsubs
(rhbz#1062296) (re: 970069a)
The new command substitution mechanism imported in 970069a from Red Hat patches introduced this bug: backtick-style command substitutions hang when processing about 117KiB of data or more. It is fixed by another Red Hat patch: https://src.fedoraproject.org/rpms/ksh/blob/642af4d6/f/ksh-20140415-hokaido.patch It saves the value of the shp->comsub flag so that it is set to 2 (usually meaning new-style $(comsubs)) in two specific cases even when processing backtick comsubs. This stops the sh_subtmpfile() function in subshell.c from creating a /tmp file. However, I think that approach is quite ugly, so I'm taking a slightly different one that has the same effect. src/cmd/ksh93/include/defs.h, src/cmd/ksh93/sh/subshell.c: - Redefine sh_subtmpfile() to pass the comsub flag as an argument. (Remove the shp pointer argument, which is redundant; a pointer to the shell state can easily be obtained in the function.) src/cmd/ksh93/sh/xec.c: sh_exec(): - Apply the Red Hat fix by passing flag 2 to sh_subtmpfile(). src/cmd/ksh93/tests/subshell.sh: - Move regress test from ce68e1b from basic.sh to here; this is the place for command substitution tests as they are subshells. - Add regress test for this bug. All other changed files: - Update sh_subtmpfile() calls to pass on the shp->comsub flag.
- Loading branch information
Showing
7 changed files
with
42 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
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