[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] scripts: environment: Properly handle SIGINT.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] scripts: environment: Properly handle SIGINT. |
Date: |
Sun, 27 Mar 2016 19:35:13 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
"Thompson, David" <address@hidden> skribis:
> On Sat, Mar 26, 2016 at 2:33 PM, Thompson, David
> <address@hidden> wrote:
>> On Sat, Mar 26, 2016 at 2:23 PM, Ludovic Courtès <address@hidden> wrote:
>>> David Thompson <address@hidden> 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?
Ludo’.