GNU bug report logs -
#31788
[PATCH] tests: Honor the return value of 'start-service'.
Previous Next
Reported by: Clément Lassieur <clement <at> lassieur.org>
Date: Mon, 11 Jun 2018 22:06:02 UTC
Severity: normal
Tags: patch
Done: Clément Lassieur <clement <at> lassieur.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hi Ludovic,
Ludovic Courtès <ludo <at> gnu.org> writes:
> Hi Clément,
>
> Clément Lassieur <clement <at> lassieur.org> skribis:
>
>> Since commit dc7b3e56337ee9d8dcd8fe7d5cab71ef536d024f, 'start-service' returns
>> the Shepherd's representation of the service as a sexp, and '#f' if the
>> service fails to start. Also, it doesn't throw an exception when the service
>> fails to start, so relying on an exception instead of relying on its return
>> value is a false positive.
>
> Looking at ‘invoke-action’ (used by ‘start-service’) in (gnu services
> herd), it seems that an exception is raised upon error:
>
> (('reply ('version 0 x ...) ('result y) ('error error)
> ('messages messages))
> (for-each display-message messages)
> (raise-shepherd-error error)
> #f)
But that's for Shepherd errors. When a service fails to start, it's not
a Shepherd error, so if my understanding is correct '(cont result)'
should be called. With result being '#f'.
(match (read sock)
(('reply ('version 0 _ ...) ('result result) ('error #f)
('messages messages))
(for-each display-message messages)
(cont result))
(('reply ('version 0 x ...) ('result y) ('error error)
('messages messages))
(for-each display-message messages)
(raise-shepherd-error error)
#f)
(x
;; invalid reply
#f))
This bug report was last modified 6 years and 340 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.