Commit Graph

106 Commits (master)

Author SHA1 Message Date
Oliver Kiddle 5331ff11c6 52594: support for POSIX real-time signals with kill and trap
Also add new -L option to kill for a more verbose listing of signals
3 months ago
Bart Schaefer 0ecc456fb2 52365: record state of exited background jobs so as to be visible in TRAPCHLD 5 months ago
Jun-ichi Takimoto 22b1a91c2a 50306: fix wait for child that was stopped/continued
do not call addbgstatus() when child is stopped/continued
2 years ago
Erik Paulson f8ec33c453 49029: Prevent shell from sending duplicate signals with MONITOR 3 years ago
Bart Schaefer cf5c4828d1 48857: declare "volatile" all globals that may be modified by signal handlers 3 years ago
Peter Stephenson 14ea665a90 users/24710: Fix job control problem with sudo.
If we use kill to test for continued existence of a process group,
we should check on failure that the error is ESRCH, as EPERM
indicates the group still has memebers but running privileged
so should be left alone.
4 years ago
Daniel Shahaf 8bc4400762 45058: internal: Add symbolic names to possible values of zexit()'s "from_where" parameter. No functional change. 4 years ago
Peter Stephenson 95211f87ed 44259: Ensure we can set signals to default even if ignored.
Previously the shell didn't take account of signals marked as

ignored on entry, which was inconsistent with other behaviour.
5 years ago
Peter Stephenson 0a20f4e5a6 43535: Fixes for bg / fg handling of superjobs.
Be more consistent about marking both superjob and subjob as
running when sending SIGCONT.

Send SIGCONT to superjob / subjob combination any time it is put
in foreground, even if thought running, since subjob may invisibly
have suspended.

When waiting for superjob, wait for subjob, too.
6 years ago
Peter Stephenson 551ff84272 43464: Another attachtty() fix.
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.
6 years ago
Peter Stephenson 07ad7fd970 Fix windowsize when reattaching to terminal on process exit 6 years ago
Eitan Adler f311619e30 433029: Testing signal return type is no longer needed 6 years ago
Peter Stephenson 449f13a467 42234: Stephane: don't kill a process if not running.
This could happen when kiiling a job.  The processs might be reused.
6 years ago
Peter Stephenson 9ad9c5cda1 42705: Another safety fix for pgrp reclaiming.
Only do this if killpg(dead_pid, 0) returns -1, indicating
the pgprp doesn't exist any more, else there is a race
if other proceses have started using it.
6 years ago
Peter Stephenson 0f29b5148e 42686: Fix previous pgrp patch.
We shouldn't do any fix ups unless the process has actually
exited.
6 years ago
Peter Stephenson 3c74891fcd 42630: Improve process group handling in pipelines.
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.
6 years ago
Peter Stephenson 97d4bdbc7e 41590 modified as 41595: make ERR_RETURN more logical.
It now operates separately at each function depth.

To keep ERR_EXIT global, make the noerrexit variable usd bit flags.

Extend tests.
7 years ago
Peter Stephenson d7110d8f01 41012: Fix premature exit from nested function in EXIT trap.
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.
7 years ago
Barton E. Schaefer 12d950ba0c 40624: conditionally handle WIFCONTINUED to properly set SP_RUNNING process status 7 years ago
Peter Stephenson f90a0447aa 40353 with tweaks to whence -v: extend directory cache use.
Now used for all autoloaded functions after load, including those
where the file was found along fpath, reducing duplication of
directory names.
7 years ago
Peter Stephenson 178e62dbfe 40342: Add directory name cache for autoload file paths.
This renders "autoload /blah/blah/*" as efficient as use of
fpath.
7 years ago
Barton E. Schaefer 4abbb4b473 39548: DEBUG for queueing_enabled 8 years ago
Peter Stephenson e35dcae40f 39436: Pass on status of SIGINT better.
Set lastval to 128 + SIGINT on interrupt.

Don't execute builtin if already interrupted at that point.
8 years ago
Peter Stephenson 327f3dd3ad 39359: Fix remaining race with orphaned subjob.
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.
8 years ago
Peter Stephenson 17fb014dc7 38094: Fix POSIX EXIT traps defined in function.
These aren't local, so set the local level to 0; else they can get
overridden incorrectly.
8 years ago
Peter Stephenson c55d855171 38024: Improve POSIX and native EXIT traps compatibility.
Allow a nested function trap to leave save and restore a POSIX
trap.

Still fails if the POSIX trap was defined in a function.
8 years ago
Peter Stephenson ab74c86edb 37999: Sticky behaviour of EXIT traps.
They now have POSIX or non-POSIX behaviour based on the setting
of POSIX_TRAPS where the trap was defined, rather than where the
trap would (or would not) be executed.

Tweaks possible.
8 years ago
Barton E. Schaefer 9f5dffa1f3 36393: process queued signals during dotrap() 9 years ago
Barton E. Schaefer 93ca77f8f7 36079: do not allow update_job() and its helpers to run the signal queue while we are processing a job exit. 9 years ago
Peter Stephenson a07f74fadd Don't rely on implicit value when saving background process status 9 years ago
Barton E. Schaefer 9958684574 36022 fix bug that some loop constructs could not be interrupted, revise signal queueing
There are two underlying ideas here:  (1) Keeping signals queued around
anything that's doing memory management (including push/pop of the heap)
has become crucial.  (2) Anytime the shell is going to run a command, be
it buitin or external, it must be both safe and necessary to process any
queued signals, so that the apparent order of signal arrival and command
execution is preserved.
9 years ago
Peter Stephenson cfd91eac07 Rearrange context saving.
Variables are now associated with the module that declares them, being
initialised and saved/restored there.  However, as many variables are
used for communication between modules, many of them are set in multiple
places, so the assignment is ambiguous.
9 years ago
Peter Stephenson d067ebcacd 33876: etc.: Separate errors and keyboards interrupts
Combination of 12 commits from interrupt_abort branch.

Basic strategy is to introduce bits to errflag and to set and
reset them separately.

Remove interrupt status on return to main keymap.

Turn off ERRFLAG_INT for always block.

Restore bit thereafter: we probably need a new variable in order
to allow user interrupts to be reset in the always block.

Add TRY_BLOCK_INTERRUPT

This works the same as TRY_BLOCK_ERROR, but for a SIGINT, too.

Ensure propagation of SIGINT from exited job.

If received by foreground job, shell uses ERRFLAG_INT, not
ERRFLAG_ERROR, to set the new state.

Reset errflag before precmd()

Add always block in _main_completion to fix ZLS_COLORS

Ensures we get the right state of $ZLS_COLORS at the end of _main_complete
even if there's an interrupt.  However, the "right state" is a bit messy
as it depends on styles.
10 years ago
Peter Stephenson b4f7ccecd9 33531 with additions: retain status of exited background jobs.
Add linked list of unwaited-for background jobs.
Truncate at value of _SC_CHILD_MAX discarding oldest.
Remove old lastpid_status mechanism for latest exited process only.
Slightly tighten safety of permanently allocated linked lists so
that this doesn't compromise signal handling.
10 years ago
Barton E. Schaefer 32473f59a3 Merge branch 'master' of git://git.code.sf.net/p/zsh/code
Conflicts:
	ChangeLog
10 years ago
Peter Stephenson cf6b0f5663 33285: apply function definition redirections at execution 10 years ago
Barton E. Schaefer 60e31a45b0 33268: interactive shells treat SIGPIPE like SIGHUP if and only if SHTTY is disconnected 10 years ago
Nikolas Garofil 4f4d2b8247 32737, 32736 (32741), 32735, 32734, 32733, 32732 (32739): Strict compilation
fixes

	Src/utils.c: properly ifdef declarations
	Src/zsh_system.h: memmove() should return its dest argument
	Src/signals.c: define ret before use
	Src/mem.c: remove unused pointers
	Src/prototypes.h: use size_t in bcopy()
	Src/compat.c: fix const declaration inconsistency
10 years ago
Peter Stephenson a06cd1766a 32479: POSIXTRAPS and implicit return values.
With POSIXTRAPS never propagate implicit return value.
In any case if not forcing a return value don't use lastval
from within the trap, use the one from the surrounding code.
10 years ago
Peter Stephenson 375115c7df unposted: updates for 4.0.2-test-1.
Update references to 4.0.2 to 4.0.3.
Additional mod_export declarations.
Additions to .distfiles.
11 years ago
Peter Stephenson 4b86cc48f7 30726: make shell options passed to emulate stick along with the emulation 12 years ago
Bart Schaefer 748bd73d88 unposted: cross-reference zmodload from the modules intro doc.
29769: follow-up 29677 to handle the case where thisjob == -1.
13 years ago
Bart Schaefer 516ea294b8 29677: Do not allow external processes in a pipeline to become suspended
when the end of the pipe is controlled by a builtin in the current shell
which cannot itself become suspended.
13 years ago
Peter Stephenson a3ae9f5d12 29643: set incompfunc to zero when executing hook or trap function 13 years ago
Bart Schaefer 98b29d02ca 29481: always return a matching job in findproc() but scan the whole list
to prefer running jobs
13 years ago
Peter Stephenson 3b6b4982b9 28258: fix undefined variable in traps 14 years ago
Peter Stephenson ade705cf5b 28253: document -h argument to atribute commands 14 years ago
Peter Stephenson c7ff1b79dd 28179, users/15314, users/15310, users/15200:
various job and process control fixes
14 years ago
Peter Stephenson 09960dc5b9 27951: Add $ZSH_EVAL_CONTEXT and $zsh_eval_contxt 14 years ago
Peter Stephenson 3206b8a2ea 27442 plus tweak: wait returns status for $! even if exited 15 years ago