From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX2dK-0007TX-N5 for guix-patches@gnu.org; Mon, 17 Jul 2017 05:48:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX2dG-0007Pp-Q3 for guix-patches@gnu.org; Mon, 17 Jul 2017 05:48:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:40570) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dX2dG-0007PL-Lb for guix-patches@gnu.org; Mon, 17 Jul 2017 05:48:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dX2dG-0005g4-Fb for guix-patches@gnu.org; Mon, 17 Jul 2017 05:48:02 -0400 Subject: [bug#27704] [PATCH] daemon: Show actual rather than collateral error when export fails. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170715105851.24979-1-janneke@gnu.org> Date: Mon, 17 Jul 2017 11:47:04 +0200 In-Reply-To: <20170715105851.24979-1-janneke@gnu.org> (Jan Nieuwenhuizen's message of "Sat, 15 Jul 2017 12:58:51 +0200") Message-ID: <87vamrbdk7.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@debbugs.gnu.org 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 secret= (inaccessible to everybody else)! > > * nix/nix-daemon/nix-daemon.cc (performOp): Catch any exportPath exceptio= n, > report and exit on that. Fixes failing later with uninformative collater= al 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 cli= entVersion, > 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. That way, we won=E2=80=99t have the assertion failure, and yet the error wi= ll correctly propagate to the client without forcing a disconnect. Could you check if that works as expected? Thank you! Ludo=E2=80=99.