unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Thompson, David" <dthompson2@worcester.edu>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH] scripts: environment: Properly handle SIGINT.
Date: Mon, 28 Mar 2016 12:54:42 -0400	[thread overview]
Message-ID: <CAJ=RwfZ12M2++O6D45CeY64aL2ay-=pizdKwpKZoqJt6jAZq2Q@mail.gmail.com> (raw)
In-Reply-To: <87zitjygby.fsf@gnu.org>

On Sun, Mar 27, 2016 at 1:35 PM, Ludovic Courtès <ludo@gnu.org> wrote:
> "Thompson, David" <dthompson2@worcester.edu> skribis:
>
>> On Sat, Mar 26, 2016 at 2:33 PM, Thompson, David
>> <dthompson2@worcester.edu> wrote:
>>> On Sat, Mar 26, 2016 at 2:23 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>>>> David Thompson <dthompson2@worcester.edu> skribis:
>>>>
>>>>> * 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?  :-)
>>>
>>> The problem is that a process within the container cannot just kill
>>> PID 1 since its the init process and the kernel protects it, so
>>> changing "2" to "1" doesn't work.  The exit status of the environment
>>> command is 0 in that case because PID 1 never received the signal and
>>> thus exits normally.
>>>
>>> I'll try to come up with a replacement test case, thanks for giving me
>>> the context in which it was added.  (I should've used 'git blame'
>>> first.)
>>
>> Coming up with a replacement test has proved very difficult.  Since
>> PID 1 is unkillable, I'm having a hell of time coming up with a clever
>> way to kill a Guile process via a signal.
>
> Would it help to change the test to:
>
>   guix environment --bootstrap --container \
>      --ad-hoc bootstrap-binaries -- sh -c 'exec kill -SEGV 2'
>
> essentially mimicking previous behavior?

This didn't work, but for the record Ludo and I figured out another
way on IRC that involves using the FFI to make Guile segfault.  Fun
times!

Pushed with that change.

- Dave

      reply	other threads:[~2016-03-28 16:54 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
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 [this message]

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='CAJ=RwfZ12M2++O6D45CeY64aL2ay-=pizdKwpKZoqJt6jAZq2Q@mail.gmail.com' \
    --to=dthompson2@worcester.edu \
    --cc=guix-devel@gnu.org \
    --cc=ludo@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).