From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thompson, David" Subject: Re: [PATCH] scripts: environment: Properly handle SIGINT. Date: Mon, 28 Mar 2016 12:54:42 -0400 Message-ID: References: <87pouhbd46.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> <871t6x14kq.fsf@gnu.org> <87zitjygby.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akaRE-0006G0-VR for guix-devel@gnu.org; Mon, 28 Mar 2016 12:54:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akaRA-0001bX-KM for guix-devel@gnu.org; Mon, 28 Mar 2016 12:54:48 -0400 Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]:35468) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akaR9-0001ay-CT for guix-devel@gnu.org; Mon, 28 Mar 2016 12:54:44 -0400 Received: by mail-qk0-x231.google.com with SMTP id o6so119828798qkc.2 for ; Mon, 28 Mar 2016 09:54:43 -0700 (PDT) In-Reply-To: <87zitjygby.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Cc: guix-devel On Sun, Mar 27, 2016 at 1:35 PM, Ludovic Court=C3=A8s wrote: > "Thompson, David" skribis: > >> On Sat, Mar 26, 2016 at 2:33 PM, Thompson, David >> wrote: >>> On Sat, Mar 26, 2016 at 2:23 PM, Ludovic Court=C3=A8s wr= ote: >>>> David Thompson 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 . We want = to >>>> make sure we don=E2=80=99t 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 =E2=80=9C2=E2=80=9D to =E2=80=9C1=E2=80=9D in this test shoul= d do the trick. Am I na=C3=AFve? :-) >>> >>> 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