dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harald van Dijk <harald@gigawatt.nl>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	DASH Mailing List <dash@vger.kernel.org>
Subject: Re: [v3 PATCH 17/17] eval: Add vfork support
Date: Fri, 8 Jan 2021 20:55:41 +0000	[thread overview]
Message-ID: <4bcabb9a-5684-98ee-e7ae-e162c985be0d@gigawatt.nl> (raw)
In-Reply-To: <E1fJkIG-0005qH-BW@gondobar>

On 18/05/2018 19:39, Herbert Xu wrote:
> This patch adds basic vfork support for the case of a simple command.
>...  
> @@ -879,17 +892,30 @@ forkchild(struct job *jp, union node *n, int mode)
>   		}
>   	}
>   	if (!oldlvl && iflag) {
> -		setsignal(SIGINT);
> -		setsignal(SIGQUIT);
> +		if (mode != FORK_BG) {
> +			setsignal(SIGINT);
> +			setsignal(SIGQUIT);
> +		}
>   		setsignal(SIGTERM);
>   	}
> +
> +	if (lvforked)
> +		return;
> +
>   	for (jp = curjob; jp; jp = jp->prev_job)
>   		freejob(jp);
>   }

This leaves SIGQUIT ignored in background jobs in interactive shells.

   ENV= dash -ic 'dash -c "kill -QUIT \$\$; echo huh" & wait'

As of dash 0.5.11, this prints "huh". Before, the subprocess process 
killed itself before it could print anything. Other shells do not leave 
SIGQUIT ignored.

(In a few other shells, this also prints "huh", but in those other 
shells, that is because the inner shell chooses to ignore SIGQUIT, not 
because the outer shell leaves it ignored.)

Cheers,
Harald van Dijk

       reply	other threads:[~2021-01-08 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180518183844.zizl3xevlcm4gzsj@gondor.apana.org.au>
     [not found] ` <E1fJkIG-0005qH-BW@gondobar>
2021-01-08 20:55   ` Harald van Dijk [this message]
2021-01-12  6:11     ` [PATCH] jobs: Always reset SIGINT/SIGQUIT handlers Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4bcabb9a-5684-98ee-e7ae-e162c985be0d@gigawatt.nl \
    --to=harald@gigawatt.nl \
    --cc=dash@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).