-
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
backtick
comsubs by making them act like $(modern) ones
ksh93 currently has three command substitution mechanisms: - type 1: old-style backtick comsubs that use a pipe; - type 3: $(modern) comsubs that use a temp file, currently with fallback to a pipe if a temp file cannot be created; - type 2: ${ shared-state; } comsubs; same as type 3, but shares state with parent environment. Type 1 is buggy. There are at least two reproducers that make it hang. The Red Hat patch applied in 4ce486a fixed a hang in backtick comsubs but reintroduced another hang that was fixed in ksh 93v-. So far, no one has succeeded in making pipe-based comsubs work properly. But, modern (type 3) comsubs use temp files. How does it make any sense to have two different command substitution mechanisms at the execution level? The specified functionality between backtick and modern command substitutions is exactly the same; the difference *should* be purely syntactic. So this commit removes the type 1 comsub code at the execution level, treating them all like type 3 (or 2). As a result, the related bugs vanish while the regression tests all pass. The only side effect that I can find is that the behaviour of bug #124 changes for backtick comsubs. But it's broken either way, so that's neutral. So this commit can now be added to my growing list of ksh93 issues fixed by simply removing code. src/cmd/ksh93/sh/xec.c: - Remove special code for type 1 comsubs from iousepipe(), sh_iounpipe(), sh_exec() and _sh_fork(). src/cmd/ksh93/include/defs.h, src/cmd/ksh93/sh/subshell.c: - Remove pipe support from sh_subtmpfile(). This also removes the use of a pipe as a fallback for $(modern) comsubs. Instead, panic and error out if temp file creation fails. If the shell cannot create a temporary file, there are fatal system problems anyway and a script should not continue. - No longer pass comsub type to sh_subtmpfile(). All other changes: - Update sh_subtmpfile() calls. src/cmd/ksh93/tests/subshell.sh: - Add two regression tests based on reproducers from bug reports. Resolves: #305 Resolves: #316
- Loading branch information
Showing
9 changed files
with
74 additions
and
139 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
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