about summary refs log tree commit diff
path: root/Src/exec.c
Commit message (Collapse)AuthorAgeFilesLines
* Rationalise use of forks and pipes. fork_earlyPeter Stephenson2018-04-201-63/+16
| | | | | | | | | | | | | | | | | Ensure we _exit instead of returning from execcmd_exec() if we have forked. Before the optimisation code after the fork always ran to the check at the end, but that code is overkill for the logic between the early fork and the existing one. Remove old workaround to fork in caller of execcmd for current shell constructs as no longer needed with early fork below. Close input of newly created pipe on fork (destined for RHS of pipe which we never execute): this replaces a workaround from zsh-workers/32171, commit 9887fc3d7b. Set last1 on early fork as needed by some instances of shell constructs on LHS of pipeline to know they are exiting.
* Ensure we _exit if forked in execcmd_exec().Peter Stephenson2018-04-201-2/+28
|
* Make early fork even earlier.Peter Stephenson2018-04-201-24/+25
| | | | | | It was after our preliminary scan of arguments to find a command. Actually, in the cases of early fork we don't need this information before forking.
* 42693: Fork early for pipelines.Peter Stephenson2018-04-201-3/+4
| | | | | | | If executing a command not at the end of a pipeline, and not optimised in the calling code, we can fork before "prefork" substitutions, at the same point as for background commands.
* 42684 (with extra comments): Fork early if in bg.Peter Stephenson2018-04-201-95/+135
| | | | | | | In execcmd the case of running the last command in a pipeline asynchronously for the purpose of & and &! is easy to work out, and we can avoid side effects and unnecessary execution time in the parent shell by forking earlier.
* 42630: Improve process group handling in pipelines.Peter Stephenson2018-04-171-1/+16
| | | | | | | | | If process group leader exits, allow a newly forked process to become process leader. If a foreground job, reattach the shell to the terminal until that happens. Unblock signals when reading output for command subsitution so that we can do this reattaching immediately.
* 42624 (plus test): avoid freeing memory that's still neededOliver Kiddle2018-04-121-5/+9
| | | | | This was occurring in a multiple function definition where a function name is duplicated.
* 42518, CVE-2018-1071: check bounds when copying path in hashcmd()Oliver Kiddle2018-03-241-1/+1
|
* 42469: necessary repairs to 42465 found by "make check"Stephane Chazelas2018-03-181-2/+2
|
* 42465: Pass up error status from readoutput().Stephane Chazelas2018-03-151-3/+13
| | | | This improves the consistency of error reporting from $(...) constructs.
* 42355: Fix use of backslashes on here doc input.Peter Stephenson2018-02-121-1/+10
| | | | | Handling of white space in particular was confusing and inconsistent with other shells.
* 42043: ZSH_DEBUG_CMD should not WARN_CREATE_GLOBALBarton E. Schaefer2018-01-141-1/+3
|
* 33395: Improvments for function managment.Peter Stephenson2017-12-221-1/+6
| | | | | | | | Functions defined inside other fucntions needs file line number adding. Particularly useful for anonymous fucntions. Add flag to indicate a function is anonymous. Done up to now by comparing the name to a pointer but this is more consistent.
* users/13148 (and workers/42060): Abort the command line when replyingDaniel Shahaf2017-12-201-6/+11
| | | | | | "[n] No" to the RM_STAR_SILENT prompt. Patch by Stephane, rebased by Mikael.
* 42123 (tweaked): take account of Dash in function names.Peter Stephenson2017-12-151-2/+20
| | | | | | Needed when comparing word code function name with autoload request. Add test.
* 41802 (minor tweaks): use heap during shell function call.Peter Stephenson2017-10-041-69/+85
| | | | | | Replaces stack for more efficient memory management. Also fix debug message when FUNCNEST is increased.
* 41787 (plus minor tweaks): use $FUNCSTACK for function nesting depth.Peter Stephenson2017-10-021-11/+6
| | | | Initialised from existing configuration value.
* 41789: Don't save fd if -1.Peter Stephenson2017-09-291-8/+11
| | | | | | We try to move an fd which isn't opend but it will feel. This needs handling specially in the new code for marking saved fd's.
* 41767: preserve nonzero exit status on interruptBarton E. Schaefer2017-09-271-1/+2
|
* 41761: Ensure status from interrupt is propagated by builtinPeter Stephenson2017-09-261-2/+9
|
* Updates for ksh array element syntax.Peter Stephenson2017-09-241-70/+16
| | | | | | | | Move detection of key/value pairs down into prefork(). Detect normal array assignment and [key]=val array assignemnt separately. Mark key / value pairs with Marker and pass up flag. Deal with marked triads specially later on.
* 41736: NO_INTERACTIVE_COMMENTS in $(...)Barton E. Schaefer2017-09-201-1/+6
|
* First go at var=([key]=value) syntax.Peter Stephenson2017-09-131-9/+77
| | | | | | | Works for both normal and typeset case, also var+=... Still to do: allow to be mixed with straight array assignment, improve typeset -p, implement [key]+=value.
* 41662: exec -a arguments weren't sanitisedPeter Stephenson2017-09-101-0/+3
|
* 41608 (plus tests): restore ERR_EXIT before function.Peter Stephenson2017-08-291-1/+1
| | | | | | | There was an exception to the usual ERR_EXIT pattern that causes problems when executing a function in an else branch. It seems the exception is no longer needed as the regression tests pass without it.
* 41590 modified as 41595: make ERR_RETURN more logical.Peter Stephenson2017-08-241-14/+27
| | | | | | | | It now operates separately at each function depth. To keep ERR_EXIT global, make the noerrexit variable usd bit flags. Extend tests.
* posted but has not shown up: fix fd problem in subshell.Peter Stephenson2017-08-151-3/+15
| | | | | Record fd's that have been saved in fdtable and if the shell forks close them as they will never be restored.
* 41464, 41466: With POSIX_BUILTINS, exec only executes sexternal commands.Peter Stephenson2017-07-271-2/+12
| | | | Document the default behaviour and add a test.
* 41317: use heap allocation in getoutputfile() to plug memory leakBarton E. Schaefer2017-06-191-2/+2
| | | | Heap is usable ever since addfilelist() of workers/31528 (commit 3c573222).
* 41043: Close pipes in shell when disowning background job.Peter Stephenson2017-05-031-0/+1
| | | | This was missing in the case of &,, causing a file descriptor leak.
* 41020: Fix "command -p"; "-p" was incorrectly left in command argumentsPeter Stephenson2017-04-281-1/+8
| | | | Also add tests for known precommand modifier issues.
* 41012: Fix premature exit from nested function in EXIT trap.Peter Stephenson2017-04-271-1/+4
| | | | | | Also add check so we don't delay an exit if we were already in an EXIT trap for the main shell, as we should in that case leave immediately.
* 41008: Handle expansions for precommand modifiersPeter Stephenson2017-04-261-35/+106
|
* 40933: Ensure we get job text in sourced files.Peter Stephenson2017-04-041-2/+2
| | | | | | | This was turned off explicitly as it was assumed not to be needed, but it is when code in a sourced file is suspended. We'll need to see if this makes start up inefficient.
* 40796: MAGIC_EQUAL_SUBST not needed with parsed assignment.Peter Stephenson2017-03-091-5/+20
| | | | | | If typeset family builtins are recognised as keywords then the value is handled as a separate expansion and we don't need the old magic behaviour, even if the option is set.
* 40760: Always tokenize unquoted - to Dash.Peter Stephenson2017-03-071-5/+6
| | | | | | This fixes use of pattern match character ranges in unusual contexts. Attempt to detect a tokenized - in cases where we don't care.
* 40654: exit cleanly from special POSIXBUILTINS in subshellsBarton E. Schaefer2017-03-041-0/+1
| | | | This patch overloads the zsh_subshell counter which is meant for $ZSH_SUBSHELL, but no one has suggested a working alternate test.
* 40576 (tweaked): entersubsh(): unblock any signals that were blocked for ↵Barton E. Schaefer2017-02-201-3/+14
| | | | | | trap handling Also small improvement to loop that resets trap handlers
* 40391: Add WARN_NESTED_VAR option and functions -W.Peter Stephenson2017-01-231-3/+10
| | | | | These are companions to WARN_CREATED_GLOBAL, warning when a variable from an enclosing scope is altered.
* 40353 with tweaks to whence -v: extend directory cache use.Peter Stephenson2017-01-161-26/+56
| | | | | | Now used for all autoloaded functions after load, including those where the file was found along fpath, reducing duplication of directory names.
* 40342: Add directory name cache for autoload file paths.Peter Stephenson2017-01-121-5/+10
| | | | | This renders "autoload /blah/blah/*" as efficient as use of fpath.
* 40335: More care with autoload function path.Peter Stephenson2017-01-121-3/+4
| | | | | | If doing "autoload -X", the path present might actually be location of file containing the function with the autoload -X. Add an explicit flag to say it's a directory for autoload.
* unposted: more care with shell function filename.Peter Stephenson2017-01-111-0/+2
| | | | | | | When updating shfunc structure to change filename we should be careful to free whatever's there already, we may now be the directory in which to find the function definition. After loading the field contains the full name of the file.
* Add features associated with autoloading a function using an absolutePeter Stephenson2017-01-111-11/+33
| | | | | | | | | | | | | path. -d defaults to normal fpath -r remembers the path without actually loading. May be combined with -d. -R does the same but it's an error if not found -X can now take a directory path: this is used to output not yet loaded functions that have an associated path.
* Additional case for ERR_RETURN and ERR_EXIT.Peter Stephenson2016-12-051-0/+1
| | | | | Don't trigger just because status is non-zero at end of current shell group.
* Extra case for ERR_RETURN and ERR_EXIT.Peter Stephenson2016-12-051-1/+9
| | | | | | Don't trigger just because status is non-zero at end of complex shell construct as this may be a case we've already suppressed.
* 39958: Add extra byte to PATH_MAX allocations.Peter Stephenson2016-11-171-8/+8
| | | | | This ensures we've got enough space for a null, although this isn't always needed.
* 39915: whence: Honor PATH_DIRS option for arguments that start with './' or ↵Daniel Shahaf2016-11-171-7/+16
| | | | | | '../'. While here, add some docstrings.
* 39901: No EXIT trap on LHS of pipeline.Peter Stephenson2016-11-101-0/+4
| | | | | There is a special case if the LHS is a shell construct. Add unit tests for both cases.
* 39571: Fix ERR_EXIT bug with && and function.Peter Stephenson2016-10-051-6/+6
| | | | | "foo && bar" inside a function could cause the code outside the function not to perform ERR_EXIT or ERR_RETURN when needed.