svn commit: r210616 - stable/8/bin/sh
jhell at dataix.net
Thu Jul 29 23:46:25 UTC 2010
So what has been commited here is implicitly stating that instead of
using ( trap 'exit 1' 2 ) in a script to catch SIGINT and exit it is now
being done on behalf of the user with no way for them to control it ?
Basically this has the same effect on a script that uses ( && ) and to
which now have the same meaning.
This script should print "PRINTME" twice when ^C during the sleep.
sleep 5000; echo "PRINTME"
Whereas this script with the old behavior would have done what is trying
to be done now for the first line but should still print only the second
"PRINTME" during a ^C of sleep.
sleep 5000 && echo "PRINTME"
And this script should not print anything when ^C is used during sleep.
trap 'exit 1' 2
sleep 5000 ; echo "PRINTME"
What is being done currently on stable/8 is incorrect...
On 07/29/2010 12:55, Jilles Tjoelker wrote:
> Author: jilles
> Date: Thu Jul 29 16:55:27 2010
> New Revision: 210616
> URL: http://svn.freebsd.org/changeset/base/210616
> MFC r208881: sh: Pass through SIGINT if interactive and job control
> is enabled.
> This already worked if without job control.
> In either case, this depends on it that a process that terminates due to
> SIGINT exits on it (so not with status 1, or worse, 0).
> sleep 5; echo continued
> This does not print "continued" any more if sleep is aborted via ctrl+c.
> Directory Properties:
> stable/8/bin/sh/ (props changed)
> Modified: stable/8/bin/sh/jobs.c
> --- stable/8/bin/sh/jobs.c Thu Jul 29 16:49:20 2010 (r210615)
> +++ stable/8/bin/sh/jobs.c Thu Jul 29 16:55:27 2010 (r210616)
> @@ -862,6 +862,7 @@ waitforjob(struct job *jp, int *origstat
> #if JOBS
> pid_t mypgrp = getpgrp();
> + int propagate_int = jp->jobctl && jp->foreground;
> int status;
> int st;
> @@ -899,6 +900,11 @@ waitforjob(struct job *jp, int *origstat
> +#if JOBS
> + else if (rootshell && iflag && propagate_int &&
> + WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
> + kill(getpid(), SIGINT);
> return st;
More information about the svn-src-stable-8