[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27704: [PATCH] daemon: Show actual rather than collateral error when
From: |
Ludovic Courtès |
Subject: |
bug#27704: [PATCH] daemon: Show actual rather than collateral error when export fails. |
Date: |
Mon, 17 Jul 2017 15:15:01 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
address@hidden (Ludovic Courtès) skribis:
> Hello,
>
> Jan Nieuwenhuizen <address@hidden> 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 exception,
>> report and exit on that. Fixes failing later with uninformative collateral
>> 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
>> clientVersion,
>> bool sign = readInt(from) == 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 ‘catch’ handler.
I’ve confirmed that it works as expected.
Pushed as 2e009ae7cdaee4ce871b3a79d50118762ee29fb6, thanks again!
Ludo’.