-
Notifications
You must be signed in to change notification settings - Fork 31
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 comsub on redirecting stdout & more (re: 2d4a787)
The referenced commit introduced a hang (writes infinite '\0' or garbage output) upon the following combination of a comsub and redirections, including a redirection of standard output: { v=$(redirect 2>&1 1>&9); } 9>&1 See the commits referenced by the referenced commit (and so on) for more background info. This is a rarely triggered but serious bug. One thing that was definitely affected is the sys/base/seq module in the modernish shell library. src/cmd/ksh93/sh/xec.c, src/cmd/ksh93/sh/io.c: - Move the comsub forking workaround back from sh_exec() to sh_redirect() so it applies to all commands, not just builtins. Also apply it for both local and permanent redirects. Seems it's the only way to be safe. src/cmd/ksh93/tests/subshell.sh: - Introducing the forking workaround caused what I believe to be a spurious failure in a test inherited from AT&T; the test itself works just fine. I think this may expose an issue with the 'kill -0' built-in command. Running 'sleep' as an external instead of built-in command works around the problem. This is for investigating another time. - Add new test for the bug fixed here.
- Loading branch information
Showing
5 changed files
with
39 additions
and
21 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