-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fork before entering shared-state command substitution
The code contains various checks to see if a subshell needs to fork, like this one in the ulimit builtin: if(shp->subshell && !shp->subshare) sh_subfork(); All checks of this form are fatally broken, as each one of them causes shared-state command substitutions to ignore parent virtual subshells. Currently the only feasible way to fix this is to fork a virtual subshell before executing a shared-state command substitution in it. In the long term I think shared-state command substitutions should probably be redesigned to disassociate them completely from the virtual subshell mechanism. src/cmd/ksh93/sh/macro.c: comsubst(): - If we're in a non-subshare virtual subshell, fork it before entering a type 2 (subshare) command substitution. src/cmd/ksh93/sh/subshell.c: - sh_assignok(): Remove subshare fix from 911d6b0 as it's redundant now that the parent of a subshare is never a virtual subshell. Go back to not doing anything if the current "subshell" is a subshare. - sh_subtracktree(), sh_subfuntree(): Similarly, remove the now-redundant subshare fixes from 13c57e4. src/cmd/ksh93/sh/xec.c: sh_exec(): - Fix a separate bug: only fork a virtual subshell before running a background job if that "subshell" is not a subshare. src/cmd/ksh93/tests/subshell.sh: - Add test for bug fixed in xec.c. - Add tests for 'ulimit', 'builtin' and 'exec' run in subshare within subshell -- all commands that use checks of the form 'if(sh.subshell && !sh.subshare) sh_subfork();'. Resolves: #289
- Loading branch information
Showing
5 changed files
with
29 additions
and
38 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