GNU bug report logs - #47172
Shepherd 0.8.1 tests fail on core-updates

Previous Next

Package: guix;

Reported by: Léo Le Bouter <lle-bout <at> zaclys.net>

Date: Mon, 15 Mar 2021 18:52:02 UTC

Severity: important

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47172 in the body.
You can then email your comments to 47172 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#47172; Package guix. (Mon, 15 Mar 2021 18:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Léo Le Bouter <lle-bout <at> zaclys.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 15 Mar 2021 18:52:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Léo Le Bouter <lle-bout <at> zaclys.net>
To: bug-guix <at> gnu.org
Subject: GNU Shepherd 0.8.1 fails on core-updates
Date: Mon, 15 Mar 2021 19:51:24 +0100
[Message part 1 (text/plain, inline)]
Some tests fail:

FAIL: tests/no-home.sh
FAIL: tests/status-sexp.sh
PASS: tests/misbehaved-client.sh
FAIL: tests/replacement.sh
PASS: tests/file-creation-mask.sh
PASS: tests/restart.sh
PASS: tests/one-shot.sh
FAIL: tests/basic.sh
PASS: tests/respawn-throttling.sh
PASS: tests/signals.sh
PASS: tests/respawn.sh
PASS: tests/forking-service.sh
PASS: tests/pid-file.sh

Attached bzip2 compressed full log
[3qhfxagkqrx96xci8ylc4lj3s4zvd2-shepherd-0.8.1.drv.bz2 (application/x-bzip, attachment)]
[signature.asc (application/pgp-signature, inline)]

Changed bug title to 'Shepherd 0.8.1 tests fail on core-updates' from 'GNU Shepherd 0.8.1 fails on core-updates' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 23 Mar 2021 15:12:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#47172; Package guix. (Wed, 24 Mar 2021 13:26:01 GMT) Full text and rfc822 format available.

Message #10 received at 47172 <at> debbugs.gnu.org (full text, mbox):

From: Léo Le Bouter <lle-bout <at> zaclys.net>
To: 47172 <at> debbugs.gnu.org
Subject: Re: bug#47172: GNU Shepherd 0.8.1 fails on core-updates
Date: Wed, 24 Mar 2021 14:25:46 +0100
[Message part 1 (text/plain, inline)]
It seems this is due to guile 3.0.5, GNU Shepherd 0.8.1 does not work
with it, it works with guile 3.0.2 however.

Thanks to Efraim on IRC for hints.

It would be great if people knowledgeable with Scheme, GNU Shepherd and
Guile could fix it, it blocks GNOME upgrade work on top of core-
updates.
[signature.asc (application/pgp-signature, inline)]

Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 23 May 2021 10:24:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#47172; Package guix. (Sun, 23 May 2021 10:26:01 GMT) Full text and rfc822 format available.

Message #15 received at 47172 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 47172 <at> debbugs.gnu.org
Subject: Re: bug#47172: Shepherd 0.8.1 tests fail on core-updates
Date: Sun, 23 May 2021 12:25:27 +0200
Hi there,

Léo Le Bouter <lle-bout <at> zaclys.net> skribis:

> Some tests fail:
>
> FAIL: tests/no-home.sh
> FAIL: tests/status-sexp.sh
> PASS: tests/misbehaved-client.sh

[...]

> It seems this is due to guile 3.0.5, GNU Shepherd 0.8.1 does not work
> with it, it works with guile 3.0.2 however.

This turns out to be due to a… miscompilation bug.

In (shepherd scripts herd), ‘run-command’ has this code:

  (let ((sock    (open-connection socket-file))
        (action* (if (and (eq? action 'detailed-status)
                          (memq service '(root shepherd)))
                     'status
                     action)))
    …)

Problem is that everything works as if (eq? action 'detailed-status)
was omitted, such that ‘herd stop root’ is interpreted as ‘herd status
root’.

Simply wrapping the condition in (pk …) “fixes” the problem.

The peval output looks good (it contains the 'detailed-status
comparison), but the assembly seems to lack the 'detailed-status
comparison altogether:

--8<---------------cut here---------------start------------->8---
Disassembly of <unnamed function> at #x29e0:

   0    (instrument-entry 15700)                              at shepherd/scripts/herd.scm:127:2
   2    (assert-nargs-ee/locals 1 11)   ;; 12 slots (0 args)
   3    (static-ref 10 15369)           ;; #f                 at shepherd/scripts/herd.scm:128:19
   5    (immediate-tag=? 10 7 0)        ;; heap-object?
   7    (je 9)                          ;; -> L1
   8    (static-ref 10 14166)           ;; #f
  10    (static-ref 9 15372)            ;; open-connection
  12    (call-scm<-scm-scm 10 10 9 111) 
  14    (static-set! 10 15358)          ;; #f
L1:
  16    (scm-ref/immediate 7 10 1)      
  17    (scm-ref/immediate 6 11 2)      
  18    (handle-interrupts)                                   at shepherd/scripts/herd.scm:128:18
  19    (call 4 2)                      
  21    (receive 1 4 12)                
  23    (scm-ref/immediate 9 11 3)      
  24    (static-ref 8 15360)            ;; #f                 at shepherd/scripts/herd.scm:134:6
  26    (immediate-tag=? 8 7 0)         ;; heap-object?
  28    (je 9)                          ;; -> L2
  29    (static-ref 8 14145)            ;; #f
  31    (static-ref 7 15363)            ;; write-command
  33    (call-scm<-scm-scm 8 8 7 111)   
  35    (static-set! 8 15349)           ;; #f
L2:
  37    (scm-ref/immediate 8 8 1)       
  38    (static-ref 7 15358)            ;; #f                 at shepherd/scripts/herd.scm:134:21
  40    (immediate-tag=? 7 7 0)         ;; heap-object?
  42    (je 9)                          ;; -> L3
  43    (static-ref 7 14131)            ;; #f
  45    (static-ref 6 15361)            ;; shepherd-command
  47    (call-scm<-scm-scm 7 7 6 111)   
  49    (static-set! 7 15347)           ;; #f
L3:
  51    (scm-ref/immediate 7 7 1)       
  52    (scm-ref/immediate 6 11 4)      
  53    (static-ref 5 15363)            ;; root
  55    (eq? 6 5)                       
  56    (je 5)                          ;; -> L4
  57    (static-ref 5 13655)            ;; shepherd
  59    (eq? 6 5)                       
  60    (jne 3)                         ;; -> L5
L4:
  61    (static-ref 9 15365)            ;; status             at shepherd/scripts/herd.scm:131:22
L5:
  63    (static-ref 1 15375)            ;; #:arguments        at shepherd/scripts/herd.scm:134:54
  65    (scm-ref/immediate 0 11 5)      
  66    (mov 4 7)                                             at shepherd/scripts/herd.scm:134:20
--8<---------------cut here---------------end--------------->8---

(This is compiled with 3.0.7 and the default optimizations, so -O2.)

To be continued…

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#47172; Package guix. (Sun, 23 May 2021 13:50:02 GMT) Full text and rfc822 format available.

Message #18 received at 47172 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 47172 <at> debbugs.gnu.org
Subject: Re: bug#47172: Shepherd 0.8.1 tests fail on core-updates
Date: Sun, 23 May 2021 15:49:17 +0200
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> skribis:

> This turns out to be due to a… miscompilation bug.
>
> In (shepherd scripts herd), ‘run-command’ has this code:
>
>   (let ((sock    (open-connection socket-file))
>         (action* (if (and (eq? action 'detailed-status)
>                           (memq service '(root shepherd)))
>                      'status
>                      action)))
>     …)
>
> Problem is that everything works as if (eq? action 'detailed-status)
> was omitted, such that ‘herd stop root’ is interpreted as ‘herd status
> root’.

A workaround that works with 3.0.7 is swapping the two ‘and’
sub-expressions:

[Message part 2 (text/x-patch, inline)]
diff --git a/modules/shepherd/scripts/herd.scm b/modules/shepherd/scripts/herd.scm
index 106de1e..39d2e34 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -126,8 +126,8 @@ of pairs."
 the daemon via SOCKET-FILE."
   (with-system-error-handling
    (let ((sock    (open-connection socket-file))
-         (action* (if (and (eq? action 'detailed-status)
-                           (memq service '(root shepherd)))
+         (action* (if (and (memq service '(root shepherd))
+                           (eq? action 'detailed-status))
                       'status
                       action)))
      ;; Send the command.
[Message part 3 (text/plain, inline)]
Ludo’.

Information forwarded to bug-guix <at> gnu.org:
bug#47172; Package guix. (Sun, 23 May 2021 15:24:01 GMT) Full text and rfc822 format available.

Message #21 received at 47172 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <marius <at> gnu.org>
To: Ludovic Courtès <ludo <at> gnu.org>, 47172 <at> debbugs.gnu.org
Cc: 48368 <at> debbugs.gnu.org
Subject: Re: bug#47172: Shepherd 0.8.1 tests fail on core-updates
Date: Sun, 23 May 2021 17:23:48 +0200
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> skriver:

> Ludovic Courtès <ludo <at> gnu.org> skribis:
>
>> This turns out to be due to a… miscompilation bug.
>>
>> In (shepherd scripts herd), ‘run-command’ has this code:
>>
>>   (let ((sock    (open-connection socket-file))
>>         (action* (if (and (eq? action 'detailed-status)
>>                           (memq service '(root shepherd)))
>>                      'status
>>                      action)))
>>     …)
>>
>> Problem is that everything works as if (eq? action 'detailed-status)
>> was omitted, such that ‘herd stop root’ is interpreted as ‘herd status
>> root’.
>
> A workaround that works with 3.0.7 is swapping the two ‘and’
> sub-expressions:
>
> diff --git a/modules/shepherd/scripts/herd.scm b/modules/shepherd/scripts/herd.scm
> index 106de1e..39d2e34 100644
> --- a/modules/shepherd/scripts/herd.scm
> +++ b/modules/shepherd/scripts/herd.scm
> @@ -126,8 +126,8 @@ of pairs."
>  the daemon via SOCKET-FILE."
>    (with-system-error-handling
>     (let ((sock    (open-connection socket-file))
> -         (action* (if (and (eq? action 'detailed-status)
> -                           (memq service '(root shepherd)))
> +         (action* (if (and (memq service '(root shepherd))
> +                           (eq? action 'detailed-status))
>                        'status
>                        action)))
>       ;; Send the command.

Cc'ing the relevant Guile bug:

  https://bugs.gnu.org/48368

See also commit 79be6a985799adc6d663890250f4fb7c12f015b4 on
'core-updates' that builds with -O1 as a less satisfactory workaround.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#47172; Package guix. (Sun, 23 May 2021 21:44:01 GMT) Full text and rfc822 format available.

Message #24 received at 47172 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Marius Bakke <marius <at> gnu.org>
Cc: 47172 <at> debbugs.gnu.org, 48368 <at> debbugs.gnu.org
Subject: Re: bug#47172: Shepherd 0.8.1 tests fail on core-updates
Date: Sun, 23 May 2021 23:43:09 +0200
[Message part 1 (text/plain, inline)]
Hello,

Marius Bakke <marius <at> gnu.org> skribis:

> Ludovic Courtès <ludo <at> gnu.org> skriver:

[...]

>> A workaround that works with 3.0.7 is swapping the two ‘and’
>> sub-expressions:
>>
>> diff --git a/modules/shepherd/scripts/herd.scm b/modules/shepherd/scripts/herd.scm
>> index 106de1e..39d2e34 100644
>> --- a/modules/shepherd/scripts/herd.scm
>> +++ b/modules/shepherd/scripts/herd.scm
>> @@ -126,8 +126,8 @@ of pairs."
>>  the daemon via SOCKET-FILE."
>>    (with-system-error-handling
>>     (let ((sock    (open-connection socket-file))
>> -         (action* (if (and (eq? action 'detailed-status)
>> -                           (memq service '(root shepherd)))
>> +         (action* (if (and (memq service '(root shepherd))
>> +                           (eq? action 'detailed-status))
>>                        'status
>>                        action)))
>>       ;; Send the command.
>
> Cc'ing the relevant Guile bug:
>
>   https://bugs.gnu.org/48368

Oh nice!  (It would have saved me a bit of time to catch up on email
beforehand.  :-))

> See also commit 79be6a985799adc6d663890250f4fb7c12f015b4 on
> 'core-updates' that builds with -O1 as a less satisfactory workaround.

I found that ‘-O2 -Ono-resolve-primitives’ also does the trick.

If we manually replace ‘memq’ by two ‘eq?’ tests (which is what the
compiler does), the same problem is exhibited:

[Message part 2 (text/x-patch, inline)]
diff --git a/modules/shepherd/scripts/herd.scm b/modules/shepherd/scripts/herd.scm
index 106de1e..513508f 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -127,7 +127,8 @@ the daemon via SOCKET-FILE."
   (with-system-error-handling
    (let ((sock    (open-connection socket-file))
          (action* (if (and (eq? action 'detailed-status)
-                           (memq service '(root shepherd)))
+                           (or (eq? service 'root)
+                               (eq? service 'shepherd)))
                       'status
                       action)))
      ;; Send the command.
[Message part 3 (text/plain, inline)]
‘-Ono-resolve-primitives’ also helps in this case.

‘-Ono-optimize-branch-chains’ has no effect.

So, not much progress, but at least we have a workaround.

Thanks,
Ludo’.

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 30 Sep 2021 08:58:02 GMT) Full text and rfc822 format available.

Notification sent to Léo Le Bouter <lle-bout <at> zaclys.net>:
bug acknowledged by developer. (Thu, 30 Sep 2021 08:58:02 GMT) Full text and rfc822 format available.

Message #29 received at 47172-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Marius Bakke <marius <at> gnu.org>
Cc: 47172-done <at> debbugs.gnu.org, 48368 <at> debbugs.gnu.org
Subject: Re: bug#47172: Shepherd 0.8.1 tests fail on core-updates
Date: Thu, 30 Sep 2021 10:57:49 +0200
Hi,

Marius Bakke <marius <at> gnu.org> skribis:

> Ludovic Courtès <ludo <at> gnu.org> skriver:

[...]

>> A workaround that works with 3.0.7 is swapping the two ‘and’
>> sub-expressions:
>>
>> diff --git a/modules/shepherd/scripts/herd.scm b/modules/shepherd/scripts/herd.scm
>> index 106de1e..39d2e34 100644
>> --- a/modules/shepherd/scripts/herd.scm
>> +++ b/modules/shepherd/scripts/herd.scm
>> @@ -126,8 +126,8 @@ of pairs."
>>  the daemon via SOCKET-FILE."
>>    (with-system-error-handling
>>     (let ((sock    (open-connection socket-file))
>> -         (action* (if (and (eq? action 'detailed-status)
>> -                           (memq service '(root shepherd)))
>> +         (action* (if (and (memq service '(root shepherd))
>> +                           (eq? action 'detailed-status))
>>                        'status
>>                        action)))
>>       ;; Send the command.
>
> Cc'ing the relevant Guile bug:
>
>   https://bugs.gnu.org/48368
>
> See also commit 79be6a985799adc6d663890250f4fb7c12f015b4 on
> 'core-updates' that builds with -O1 as a less satisfactory workaround.

The bug has been fixed in Guile (will be in 3.0.8), worked around in
Shepherd commit a066c5ac05037a6ffad8e4ea3e8de8150869aa8b, and worked
around in Guix on ‘core-updates’, so I think we can close it now.

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 28 Oct 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 153 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.