Don't output double-quotes inside variable expansion/arithmetic
expansion region in here-documents. When leaving the arithmetic
expansion syntax mode, adjust the dblquote flag according to
previous syntax, in order to avoid splitting of quoted variables.
foreground child is running. Formerly, traps were exceuted after the
next child exit.
The enables the user to put a breaking wrapper around a blocking
application:
(trap 'echo trap ; exit 1' 2; ./pestyblocker; echo -n)
The "echo -n" after the child call is needed to prevent sh from
optimizing the trap-executing shell away. I'm working on this.
multiple times when performing nested variable expansion, and
preserve some quoting information in order to avoid removing
apparently empty expansion result.
i.e. this makes emacs usable from system(3). Programs called from
shellscripts are now required to exit with proper signal status. That
means, they have to kill themself. Exiting with faked numerical exit
code is not sufficient.
Exit with proper signal status if script exits on signal.
Make the wait builtin interruptable, both with and without traps set.
Use volatile sig_atomic_t where (and only where) appropriate.
(Almost) fix printing of newlines on SIGINT.
Make traps setable from trap handlers. This is needed for shellscripts
that catch SIGINT for cleanup work but intend to exit on it, hance
have to kill themself from a trap handler. I.e. mkdep.
While I'm at it, make it -Wall clean. -Wall is not enabled in
Makefile, since vararg warnx() macro calls in usr.bin/printf/printf.c
are not -Wall-able.
PR: 1206
Obtained from: Basic SIGINT fix from Bruce Evans
Removed explicit dependencies of foo.o on foo.c. These were mainly
placeholders for comments about missing dependencies of tools objects
on headers. This problem needs to be handled more generally.
urgent need is when you run sh around a program that intentionally
uses SIGQUIT/SIGINT for asynchronous events, i.e. $EDITOR started from
system(2), like many mailers do. This fixes PR bin/1206 and possibly
bin/4241.
The solution committed has been tested for a large number of possible
cases (see recent discussion on cvs-committers). I completed a make
world, made sure 'make world' is interruptable and used the changed
/bin/sh as a login shell all day, including job control and using
SIGQUIT-catching programs (to write this message :-).
PR: bin/1206
Reviewed by: discussion on cvs-commiters
cast value that was always ignored. Rev.1.9 of trap.c made this
more bogus by returning a semantically different value after calling
siginterrupt(). Avoid these problems by not returning a value.
trap 'echo xxx' 1 2 3 15
read x
is not interrupted by ^C (due to restartable read syscall) and must be
interrupted per POSIX
Worse case:
read -t 5 x
hangs forever after ^C pressed (supposed to timeout after 5 secs)
Fixed by adding siginterrupt(signo, 1) after catch handler installed
2) Do not reinstall sighandler immediately after it is called,
BSD do it for us
'read' command to return an error if the user fails to supply any
input withink a given time period. The behaviour of this option is
similar to that of the like-named option in ksh93.
Reviewed by: joerg