* [bug#27704] [PATCH] daemon: Show actual rather than collateral error when export fails.
@ 2017-07-15 10:58 Jan Nieuwenhuizen
2017-07-17 9:47 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Jan Nieuwenhuizen @ 2017-07-15 10:58 UTC (permalink / raw)
To: 27704
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.
---
nix/nix-daemon/nix-daemon.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 7d26b6135..aeeadf144 100644
--- 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);
+ }
sink.flush();
stopWork();
writeInt(1, to);
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [bug#27704] [PATCH] daemon: Show actual rather than collateral error when export fails.
2017-07-15 10:58 [bug#27704] [PATCH] daemon: Show actual rather than collateral error when export fails Jan Nieuwenhuizen
@ 2017-07-17 9:47 ` Ludovic Courtès
2017-07-17 13:15 ` bug#27704: " Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2017-07-17 9:47 UTC (permalink / raw)
To: Jan Nieuwenhuizen; +Cc: 27704
Hello,
Jan Nieuwenhuizen <janneke@gnu.org> 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.
That way, we won’t have the assertion failure, and yet the error will
correctly propagate to the client without forcing a disconnect.
Could you check if that works as expected?
Thank you!
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#27704: [PATCH] daemon: Show actual rather than collateral error when export fails.
2017-07-17 9:47 ` Ludovic Courtès
@ 2017-07-17 13:15 ` Ludovic Courtès
0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2017-07-17 13:15 UTC (permalink / raw)
To: Jan Nieuwenhuizen; +Cc: 27704-done
ludo@gnu.org (Ludovic Courtès) skribis:
> Hello,
>
> Jan Nieuwenhuizen <janneke@gnu.org> 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’.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-17 13:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-15 10:58 [bug#27704] [PATCH] daemon: Show actual rather than collateral error when export fails Jan Nieuwenhuizen
2017-07-17 9:47 ` Ludovic Courtès
2017-07-17 13:15 ` bug#27704: " Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.