summaryrefslogtreecommitdiff
path: root/Src/exec.c
AgeCommit message (Collapse)AuthorFilesLines
2019-12-1545025: fix re-entrancy problem with memory management in readoutput().Peter Stephenson1-25/+36
This could cause a signal received during $(...) to corrupt memory.
2019-12-1145004: Fix typos in commentsMartijn Dekker1-1/+1
2019-10-1644841: Better checking of errors from "nice"_RuRo_ (Андрей Стоцкий)1-2/+5
2019-08-0344635: Don't apply STAT_NOPRINT to backgrounded jobsPeter Stephenson1-1/+2
2019-07-0244480: Don't automatically close externally visible file descroptors.Peter Stephenson1-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.
2019-05-2044307: allow for atoi() returning a negative numberOliver Kiddle1-1/+1
2019-04-1044214: <(...) substitutions shouldn't grab the terminalEric Freese1-1/+1
2019-03-1944132: don't hash commands beginning with /Charles Blake1-0/+2
2018-11-0943723: file descriptor could leak on fork errorKamil Dudka1-1/+2
2018-10-0943660: extend 43653 when final exit is implicit.Peter Stephenson1-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.
2018-09-2543489: Add error checking on a new write() call.Daniel Shahaf1-1/+4
Silences a compiler warning (write(2) is declared with warn_unused_result in current Debian Unstable).
2018-09-1643464: Another attachtty() fix.Peter Stephenson1-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.
2018-09-1243446: More entersubsh() / addproc() wiring.Peter Stephenson1-15/+22
Fix additional races by passing back use of list_pipe_job from subshell.
2018-09-0743409: Fix process group setting in main shell.Peter Stephenson1-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.
2018-09-03CVE-2018-0502, CVE-2018-13259: Fix two security issues in shebang line parsing.Anthony Sottile1-16/+20
See NEWS for more information. Patch by Anthony Sottile and Buck Evan.
2018-07-1043156, 43157: Need to allow for extra space in gethere().Peter Stephenson1-3/+5
The point can now increment twice per iteration.
2018-07-09users/23531: Error exit/return fixes.Peter Stephenson1-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.
2018-06-15users/23472: Add $sysparams[procsubstpid] to zsh/systemPeter Stephenson1-0/+10
2018-05-1142101 (tweaked): assigning shell status to array was brokendana1-2/+6
2018-05-01unposted (branch fork_early): Fork early for pipelines.Peter Stephenson1-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.
2018-04-2947201: fix 42355 for multiple backslashesRicardo Giorni1-6/+6
2018-04-25unposted: Correct process substitution buffer size in the PATH_DEV_FD codepath.Daniel Shahaf1-1/+1
2018-04-2442708: fix for process substitution.Peter Stephenson1-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.
2018-04-2042684 (with extra comments): Fork early if in bg.Peter Stephenson1-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.
2018-04-1742630: Improve process group handling in pipelines.Peter Stephenson1-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.
2018-04-1242624 (plus test): avoid freeing memory that's still neededOliver Kiddle1-5/+9
This was occurring in a multiple function definition where a function name is duplicated.
2018-03-2442518, CVE-2018-1071: check bounds when copying path in hashcmd()Oliver Kiddle1-1/+1
2018-03-1842469: necessary repairs to 42465 found by "make check"Stephane Chazelas1-2/+2
2018-03-1542465: Pass up error status from readoutput().Stephane Chazelas1-3/+13
This improves the consistency of error reporting from $(...) constructs.
2018-02-1242355: Fix use of backslashes on here doc input.Peter Stephenson1-1/+10
Handling of white space in particular was confusing and inconsistent with other shells.
2018-01-1442043: ZSH_DEBUG_CMD should not WARN_CREATE_GLOBALBarton E. Schaefer1-1/+3
2017-12-2233395: Improvments for function managment.Peter Stephenson1-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.
2017-12-20users/13148 (and workers/42060): Abort the command line when replyingDaniel Shahaf1-6/+11
"[n] No" to the RM_STAR_SILENT prompt. Patch by Stephane, rebased by Mikael.
2017-12-1542123 (tweaked): take account of Dash in function names.Peter Stephenson1-2/+20
Needed when comparing word code function name with autoload request. Add test.
2017-10-0441802 (minor tweaks): use heap during shell function call.Peter Stephenson1-69/+85
Replaces stack for more efficient memory management. Also fix debug message when FUNCNEST is increased.
2017-10-0241787 (plus minor tweaks): use $FUNCSTACK for function nesting depth.Peter Stephenson1-11/+6
Initialised from existing configuration value.
2017-09-2941789: Don't save fd if -1.Peter Stephenson1-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.
2017-09-2741767: preserve nonzero exit status on interruptBarton E. Schaefer1-1/+2
2017-09-2641761: Ensure status from interrupt is propagated by builtinPeter Stephenson1-2/+9
2017-09-24Updates for ksh array element syntax.Peter Stephenson1-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.
2017-09-2041736: NO_INTERACTIVE_COMMENTS in $(...)Barton E. Schaefer1-1/+6
2017-09-13First go at var=([key]=value) syntax.Peter Stephenson1-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.
2017-09-1041662: exec -a arguments weren't sanitisedPeter Stephenson1-0/+3
2017-08-2941608 (plus tests): restore ERR_EXIT before function.Peter Stephenson1-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.
2017-08-2441590 modified as 41595: make ERR_RETURN more logical.Peter Stephenson1-14/+27
It now operates separately at each function depth. To keep ERR_EXIT global, make the noerrexit variable usd bit flags. Extend tests.
2017-08-15posted but has not shown up: fix fd problem in subshell.Peter Stephenson1-3/+15
Record fd's that have been saved in fdtable and if the shell forks close them as they will never be restored.
2017-07-2741464, 41466: With POSIX_BUILTINS, exec only executes sexternal commands.Peter Stephenson1-2/+12
Document the default behaviour and add a test.
2017-06-1941317: use heap allocation in getoutputfile() to plug memory leakBarton E. Schaefer1-2/+2
Heap is usable ever since addfilelist() of workers/31528 (commit 3c573222).
2017-05-0341043: Close pipes in shell when disowning background job.Peter Stephenson1-0/+1
This was missing in the case of &,, causing a file descriptor leak.
2017-04-2841020: Fix "command -p"; "-p" was incorrectly left in command argumentsPeter Stephenson1-1/+8
Also add tests for known precommand modifier issues.