summary refs log tree commit diff
path: root/Src/exec.c
Commit message (Collapse)AuthorAgeFilesLines
* 45083: Add signal protection to execarith().Peter Stephenson2019-12-181-0/+3
| | | | | Otherwise we could get re-entrancy in memory functions when setting variables.
* 45066: internal: Document forklevel, locallevel, and exit_pending.Daniel Shahaf2019-12-181-0/+4
|
* 45058: internal: Add symbolic names to possible values of zexit()'s ↵Daniel Shahaf2019-12-171-1/+1
| | | | "from_where" parameter. No functional change.
* 45025: fix re-entrancy problem with memory management in readoutput().Peter Stephenson2019-12-151-25/+36
| | | | This could cause a signal received during $(...) to corrupt memory.
* 45004: Fix typos in commentsMartijn Dekker2019-12-111-1/+1
|
* 44841: Better checking of errors from "nice"_RuRo_ (Андрей Стоцкий)2019-10-161-2/+5
|
* 44635: Don't apply STAT_NOPRINT to backgrounded jobsPeter Stephenson2019-08-031-1/+2
|
* 44480: Don't automatically close externally visible file descroptors.Peter Stephenson2019-07-021-1/+4
| | | | | | | | | | These are descriptors marked FDT_EXTERNAL. Make all sysopen'ed file descriptors FDT_EXTERNAL. Make =(...) call closem() consistent with other substitutions. Document file descriptors are left open.
* 44307: allow for atoi() returning a negative numberOliver Kiddle2019-05-201-1/+1
|
* 44214: <(...) substitutions shouldn't grab the terminalEric Freese2019-04-101-1/+1
|
* 44132: don't hash commands beginning with /Charles Blake2019-03-191-0/+2
|
* 43723: file descriptor could leak on fork errorKamil Dudka2018-11-091-1/+2
|
* 43660: extend 43653 when final exit is implicit.Peter Stephenson2018-10-091-24/+25
| | | | | | | Combine logic for case after committed to exit (shell_exiting) with case where exit occurred in a function we nee to unwind (exit_pending). Add sarky note for future generations to be confused at.
* 43489: Add error checking on a new write() call.Daniel Shahaf2018-09-251-1/+4
| | | | | Silences a compiler warning (write(2) is declared with warn_unused_result in current Debian Unstable).
* 43464: Another attachtty() fix.Peter Stephenson2018-09-161-6/+7
| | | | | | | | | If list_pipe_job triggered more than once we need to know the most recent process group leader, so record that both if the attach happened in the main shell on in entersubsh(). Also don't pass back proocess group for ESUB_ASYNC subshells.
* 43446: More entersubsh() / addproc() wiring.Peter Stephenson2018-09-121-15/+22
| | | | | Fix additional races by passing back use of list_pipe_job from subshell.
* 43409: Fix process group setting in main shell.Peter Stephenson2018-09-071-17/+28
| | | | | | | | | A newly forked subshell now reports back the process group it will be using for the main shell to record. This prevents an error where the shell incorrectly thought an exiting process owned the terminal and so grabbed it back, putting the foreground process into the background.
* CVE-2018-0502, CVE-2018-13259: Fix two security issues in shebang line parsing.Anthony Sottile2018-09-031-16/+20
| | | | | | See NEWS for more information. Patch by Anthony Sottile and Buck Evan.
* 43156, 43157: Need to allow for extra space in gethere().Peter Stephenson2018-07-101-3/+5
| | | | The point can now increment twice per iteration.
* users/23531: Error exit/return fixes.Peter Stephenson2018-07-091-0/+17
| | | | | | | | | | Fix regression with trap on left hand side of pipe. Fix forced return from shell structure within nested function. Fix tests exiting too early. Add new test case.
* users/23472: Add $sysparams[procsubstpid] to zsh/systemPeter Stephenson2018-06-151-0/+10
|
* 42101 (tweaked): assigning shell status to array was brokendana2018-05-111-2/+6
|
* unposted (branch fork_early): Fork early for pipelines.Peter Stephenson2018-05-011-82/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Move fork before our preliminary scan of arguments to find a command: in the cases of early fork we don't need this information before forking. Ensure we _exit if forked in execcmd_exec(). Rationalise use of forks and pipes. 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.
* 47201: fix 42355 for multiple backslashesRicardo Giorni2018-04-291-6/+6
|
* unposted: Correct process substitution buffer size in the PATH_DEV_FD codepath.Daniel Shahaf2018-04-251-1/+1
|
* 42708: fix for process substitution.Peter Stephenson2018-04-241-8/+16
| | | | | | | | | Don't close associated file descriptors in the closem() tidy up function as they should remain visible to external processes. Override if about to exit. Unit test for the failing case: note this relies on the existence of /proc/self/fd or equivalent.
* 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.