unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: David Thompson <dthompson2@worcester.edu>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] scripts: environment: Properly handle SIGINT.
Date: Sat, 26 Mar 2016 19:23:17 +0100	[thread overview]
Message-ID: <871t6x14kq.fsf@gnu.org> (raw)
In-Reply-To: <87pouhbd46.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> (David Thompson's message of "Sat, 26 Mar 2016 09:08:41 -0400")

David Thompson <dthompson2@worcester.edu> skribis:

> Has anyone ever been really annoyed that C-c doesn't work in a bash
> shell spawned by 'guix environment'?  Me too!  And I finally got around
> to fixing it.  I would like to get this in before 0.10.0 is released.

Indeed, that’s annoyed me a few times.  :-)  (C-z does work though.)

> From ec7994eec73d322386abbcd901da1b1d2f6f7733 Mon Sep 17 00:00:00 2001
> From: David Thompson <dthompson2@worcester.edu>
> Date: Sat, 26 Mar 2016 08:45:08 -0400
> Subject: [PATCH] scripts: environment: Properly handle SIGINT.
>
> Switching to execlp means that the process spawned in a container is PID
> 1, which obsoleted one of the 'guix environment --container' tests
> because the init process can't be killed in the usual manner.
>
> * guix/scripts/environment.scm (launch-environment/fork): New procedure.
> (launch-environment): Switch from system* to execlp.  Add handler for
> SIGINT.
> (guix-environment): Use launch-environment/fork.

Isn’t it enough to add the ‘sigaction’ call to fix the C-c issue?

Now, it’s nice to be PID 1 instead of PID 2, but that seems to be a
separate issue, no?

> * tests/guix-environment-container.sh: Remove obsolete test.

[...]

> -if guix environment --bootstrap --container \
> -	--ad-hoc bootstrap-binaries -- kill -SEGV 2
> -then false;
> -else
> -    test $? -gt 127
> -fi

This test was added in light of <http://bugs.gnu.org/21958>.  We want to
make sure we don’t lose that property.

What happens exactly when a signal is sent to PID 1?  I would expect
that its parent process, which is outside the container in a waitpid
call, would simply get its exit value in the normal way, and thus,
changing “2” to “1” in this test should do the trick.  Am I naïve?  :-)

Thanks for looking into it!

Ludo’.

  reply	other threads:[~2016-03-26 18:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-26 13:08 [PATCH] scripts: environment: Properly handle SIGINT David Thompson
2016-03-26 18:23 ` Ludovic Courtès [this message]
2016-03-26 18:33   ` Thompson, David
2016-03-26 20:53     ` Thompson, David
2016-03-27 17:35       ` Ludovic Courtès
2016-03-28 16:54         ` Thompson, David

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=871t6x14kq.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=dthompson2@worcester.edu \
    --cc=guix-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).