summaryrefslogtreecommitdiff
path: root/Src/exec.c
AgeCommit message (Collapse)AuthorFilesLines
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.
2017-04-2741012: Fix premature exit from nested function in EXIT trap.Peter Stephenson1-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.
2017-04-2641008: Handle expansions for precommand modifiersPeter Stephenson1-35/+106
2017-04-0440933: Ensure we get job text in sourced files.Peter Stephenson1-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.
2017-03-0940796: MAGIC_EQUAL_SUBST not needed with parsed assignment.Peter Stephenson1-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.
2017-03-0740760: Always tokenize unquoted - to Dash.Peter Stephenson1-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.
2017-03-0440654: exit cleanly from special POSIXBUILTINS in subshellsBarton E. Schaefer1-0/+1
This patch overloads the zsh_subshell counter which is meant for $ZSH_SUBSHELL, but no one has suggested a working alternate test.
2017-02-2040576 (tweaked): entersubsh(): unblock any signals that were blocked for ↵Barton E. Schaefer1-3/+14
trap handling Also small improvement to loop that resets trap handlers
2017-01-2340391: Add WARN_NESTED_VAR option and functions -W.Peter Stephenson1-3/+10
These are companions to WARN_CREATED_GLOBAL, warning when a variable from an enclosing scope is altered.
2017-01-1640353 with tweaks to whence -v: extend directory cache use.Peter Stephenson1-26/+56
Now used for all autoloaded functions after load, including those where the file was found along fpath, reducing duplication of directory names.
2017-01-1240342: Add directory name cache for autoload file paths.Peter Stephenson1-5/+10
This renders "autoload /blah/blah/*" as efficient as use of fpath.
2017-01-1240335: More care with autoload function path.Peter Stephenson1-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.
2017-01-11unposted: more care with shell function filename.Peter Stephenson1-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.
2017-01-11Add features associated with autoloading a function using an absolutePeter Stephenson1-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.
2016-12-05Additional case for ERR_RETURN and ERR_EXIT.Peter Stephenson1-0/+1
Don't trigger just because status is non-zero at end of current shell group.
2016-12-05Extra case for ERR_RETURN and ERR_EXIT.Peter Stephenson1-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.
2016-11-1739958: Add extra byte to PATH_MAX allocations.Peter Stephenson1-8/+8
This ensures we've got enough space for a null, although this isn't always needed.
2016-11-1739915: whence: Honor PATH_DIRS option for arguments that start with './' or ↵Daniel Shahaf1-7/+16
'../'. While here, add some docstrings.
2016-11-1039901: No EXIT trap on LHS of pipeline.Peter Stephenson1-0/+4
There is a special case if the LHS is a shell construct. Add unit tests for both cases.
2016-10-0539571: Fix ERR_EXIT bug with && and function.Peter Stephenson1-6/+6
"foo && bar" inside a function could cause the code outside the function not to perform ERR_EXIT or ERR_RETURN when needed.
2016-10-0539568: "! <complex-command>" suppresses ERR_EXITPeter Stephenson1-2/+7
2016-10-0539566: Improve usefulness of command_not_found_handler.Peter Stephenson1-5/+8
Don't behave as if command not found if return status is non-zero as this may simply be the return status of the replacement command. Let the function report a command not found instead.
2016-10-0339545: Add some missing unqueue_signals().Peter Stephenson1-0/+3
All of these are added simply to fit existing logic in other branches.
2016-10-0339521: Refactor start of execcmd().Peter Stephenson1-46/+81
By splitting into _analyse and _exec execpline2() has easier access to the state at the start of execution. Use this to ensure we fork if this is a builtin with no arguments.
2016-10-0239540: "! command" should suppress ERR_EXIT and ERR_RETURNPeter Stephenson1-2/+6
2016-09-3039517: back off 39502 (WC_ASSIGN causes fork in pipe).Peter Stephenson1-1/+1
This isn't a robust fix as WC_ASSIGNs simply precede the main wordcode.
2016-09-2939507: TMPSUFFIX for =(...)Barton E. Schaefer1-0/+9
2016-09-2939470: failure to open a supposedly unique temp file name should result in ↵Barton E. Schaefer1-5/+11
an error Also band-aid for signal-related race conditions in temp file name generation
2016-09-2939502: Fork for assignment in LHS of pipeline.Peter Stephenson1-1/+2
foo=bar | stuff left the value of foo set to bar as we didn't realise we needed to fork.
2016-09-2934943: Fixes for "command" with multiple options.Peter Stephenson1-37/+116
These need to combine properly, and alos "command -p" with either -v or -V needs to search for builtins and then using the default system path.
2016-09-2739437: use list_pipe_pid in assignment for clarityBarton E. Schaefer1-1/+1
2016-09-2539436: Pass on status of SIGINT better.Peter Stephenson1-1/+2
Set lastval to 128 + SIGINT on interrupt. Don't execute builtin if already interrupted at that point.
2016-09-2539435: Further fix for pgrp of funny pipelines.Peter Stephenson1-1/+2
Don't set gleader of SUBJOB at the point of creation if the SUPERJOB has no processes yet.
2016-09-1939381: handle save/restore of variable values when "typeset"-related ↵Barton E. Schaefer1-2/+2
reserved words are prefixed by an assignment
2016-09-1639362: another race with pipeline handling.Peter Stephenson1-25/+9
When forking the shell to control the right hand side, the forked subshell now always starts its own process group, to avoid getting a spurious additional SIGSTOP.
2016-09-1639359: Fix remaining race with orphaned subjob.Peter Stephenson1-1/+43
When shell is forked to run right hand side of pipieline it should use its own PID as process group if the left hand side of the pipeline has already exited.