-
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.
Browse files
Browse the repository at this point in the history
Some of the behaviours changes effectuated by the SH_PROFILE flag (on while executing profile scripts like .kshrc) *should* remain in effect in subshells. These include: * $0 does not change within ksh functions (sh/macro.c:2856) * dot scripts are parsed with SH_FUNEVAL, i.e., line by line and not all at once (bltins/misc.c:325) * background job commands for the jobs list should not be taken from the history file (sh/jobs.c:1165) * syntax error messages do not add an extra line number indication (sh/lex.c:2118) The two referenced commits potentially introduced incorrect behaviour for the above. On the other hand, the behaviours that *should* change in subshells, even with SH_PROFILE on, and thus were fixed by the referenced commits, are these: * a background job from a subshell should not print a job number (sh/xec.c:1560) * 'return' outside of functions in a subshell should still act like 'exit' (bltins/cflow.c:47) So the latter two cases need to be fixed separately instead, i.e., without turning off the SH_PROFILE flag. src/cmd/ksh93/sh/subshell.c, src/cmd/ksh93/sh/args.c: - Revert changes from the referenced commits: do not turn off the SH_PROFILE flag in subshells, or before forking to execute a process substitution. src/cmd/ksh93/include/shell.h, src/cmd/ksh93/sh/args.c, src/cmd/ksh93/sh/xec.c: - Add SH_PROCSUB state flag. - Set it in procsubst() before calling sh_exec() to run a process substitution. This is done before forking, so a sh.realsubshell check is not suitable for this; hence the state flag. - In sh_exec(), do not print job number if sh_isstate(SH_PROCSUB). This reimplements the bugfix from the first referenced commit. src/cmd/ksh93/bltins/cflow.c: - When determining whether return should act like exit, do not honour SH_PROFILE if we're in a subshell (virtual or forked).
- Loading branch information
Showing
8 changed files
with
21 additions
and
10 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