From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] scripts: environment: Properly handle SIGINT. Date: Sat, 26 Mar 2016 19:23:17 +0100 Message-ID: <871t6x14kq.fsf@gnu.org> References: <87pouhbd46.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> 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]:41723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajsrs-0005cm-W0 for guix-devel@gnu.org; Sat, 26 Mar 2016 14:23:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ajsro-0003pd-Me for guix-devel@gnu.org; Sat, 26 Mar 2016 14:23:23 -0400 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") 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: David Thompson Cc: guix-devel@gnu.org David Thompson 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=E2=80=99s annoyed me a few times. :-) (C-z does work though.) > From ec7994eec73d322386abbcd901da1b1d2f6f7733 Mon Sep 17 00:00:00 2001 > From: David Thompson > 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=E2=80=99t it enough to add the =E2=80=98sigaction=E2=80=99 call to fix = the C-c issue? Now, it=E2=80=99s 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 . We want to make sure we don=E2=80=99t lose that property. What happens exactly when a signal is sent to PID=C2=A01? 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 should do = the trick. Am I na=C3=AFve? :-) Thanks for looking into it! Ludo=E2=80=99.