From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX5sc-0000Or-8O for guix-patches@gnu.org; Mon, 17 Jul 2017 09:16:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX5sZ-0006fE-0A for guix-patches@gnu.org; Mon, 17 Jul 2017 09:16:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:40719) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dX5sY-0006f8-T9 for guix-patches@gnu.org; Mon, 17 Jul 2017 09:16:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dX5sY-0003s1-Nw for guix-patches@gnu.org; Mon, 17 Jul 2017 09:16:02 -0400 Subject: bug#27704: [PATCH] daemon: Show actual rather than collateral error when export fails. Resent-To: guix-patches@gnu.org Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170715105851.24979-1-janneke@gnu.org> <87vamrbdk7.fsf@gnu.org> Date: Mon, 17 Jul 2017 15:15:01 +0200 In-Reply-To: <87vamrbdk7.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 17 Jul 2017 11:47:04 +0200") Message-ID: <87r2xf8asq.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Jan Nieuwenhuizen Cc: 27704-done@debbugs.gnu.org ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > Hello, > > Jan Nieuwenhuizen skribis: > >> Having the wrong permissions on /etc/guix/signing-key.sec gives >> >> guix-daemon: nix/libutil/serialise.cc:15: virtual nix::BufferedSink:= :~BufferedSink(): Assertion `!bufPos' failed. >> >> this patch changes that to >> >> guix-daemon: error: file `/etc/guix/signing-key.sec' should be secre= t (inaccessible to everybody else)! >> >> * nix/nix-daemon/nix-daemon.cc (performOp): Catch any exportPath excepti= on, >> report and exit on that. Fixes failing later with uninformative collate= ral error. > > Good catch! > >> --- a/nix/nix-daemon/nix-daemon.cc >> +++ b/nix/nix-daemon/nix-daemon.cc >> @@ -436,7 +436,13 @@ static void performOp(bool trusted, unsigned int cl= ientVersion, >> bool sign =3D readInt(from) =3D=3D 1; >> startWork(); >> TunnelSink sink(to); >> - store->exportPath(path, sign, sink); >> + try { >> + store->exportPath(path, sign, sink); >> + } >> + catch (std::exception &e) { >> + fprintf (stderr, "guix-daemon: error: %s\n", e.what ()); >> + exit (EXIT_FAILURE); > > I think we should simply do: > > sink.flush(); > throw e; > > in the =E2=80=98catch=E2=80=99 handler. I=E2=80=99ve confirmed that it works as expected. Pushed as 2e009ae7cdaee4ce871b3a79d50118762ee29fb6, thanks again! Ludo=E2=80=99.