Subject: Re: bug#48114: Disarchive occasionally fails tests

From: Ludovic Courtès <[email-masked]>
Date: Sun, 02 May 2021 21:57:43 +0200

Hello!

Timothy Sample <[email-masked]> skribis:

> I can’t seem to reproduce this.  I’ve run the test suite many, many
> times, but I also tried:

I can reproduce it quickly with:

  while make check TESTS=tests/kinds/octal.scm -j5 ; do : ; done

… in C locale (LC_ALL & co. all unset).

> However, isn’t it possible that these values aren’t the culprits?  With
> the “pk” calls you added, isn’t it printing the last OK value without
> telling us the value causing the issue?

You’re right, the values printed are not the culprit.  The problem comes
from the generator (I had to raise the (quickcheck …) form out of
‘test-assert’ so I could get a backtrace):

--8<---------------cut here---------------start------------->8---
Backtrace:
          13 (primitive-load "/data/src/disarchive/./build-aux/test-driver.scm")
In ice-9/eval.scm:
    619:8 12 (_ #(#(#<directory (guile-user) 7fccb09d9f00> ((() "./tests/kinds/octal.scm") (# . "no") (# . #) ?)) #))
    619:8 11 (_ #(#(#(#(#(#(#(#(#<directory (guile-user) 7fccb09d9f00> ("./tests/kinds/octal?") ?)) ?) ?) ?) ?) ?) ?))
In ice-9/boot-9.scm:
    142:2 10 (dynamic-wind _ _ #<procedure 7fccaf5b81a0 at ice-9/eval.scm:330:13 ()>)
In unknown file:
           9 (primitive-load "./tests/kinds/octal.scm")
In quickcheck.scm:
    118:6  8 (check #<<quickcheck-config> seed: 321557891 stop?: #<procedure 7fccaf8c3540 at ice-9/eval.scm:336:13?> ?)
    98:12  7 (check-results _ #<<property> names: (octal) gen/arbs: (#<<arbitrary> gen: #<<generator> proc: #<proce?>)
In quickcheck/generator.scm:
     65:2  6 (_ 7 #<<rng-state> start: #(1907167801 2749187034 1190323419 1039883844 766725436 3567744198) s1: #(29?>)
     65:2  5 (_ 7 #<<rng-state> start: #(1907167801 2749187034 1190323419 1039883844 766725436 3567744198) s1: #(29?>)
    78:17  4 (_ 7 #<<rng-state> start: #(1907167801 2749187034 1190323419 1039883844 766725436 3567744198) s1: #(28?>)
   105:22  3 (_ _)
In tests/kinds.scm:
    84:22  2 (fix-unstructured-octal-value #<<unstructured-octal> value: 7 source: #<<zero-string> value: "\U0f99aa?>)
    86:47  1 (_ _)
In unknown file:
           0 (substring "\U0f99aa?\U0ff7c1\U0fb97a\U0ff933?\U0fe7a1" 6 8)

ERROR: In procedure substring:
Value out of range 6 to 7: 8
--8<---------------cut here---------------end--------------->8---

Note that this is in C locale, which may mean that ‘regexp-exec’, which
passes strings to libc, gets offsets wrong somehow (see
‘fixup_multibyte_match’ in libguile), though I couldn’t reproduce it
with the string above.

Anyway, ‘guix build disarchive’ builds in en_US.utf8 locale, so the
thing above is probably a wrong lead.

If I switch to en_US.utf8, I occasionally get the following error
instead:

--8<---------------cut here---------------start------------->8---
test-name: [prop] Serializing is reversible
location: tests/kinds/octal.scm:154
source:
+ (test-assert
+   "[prop] Serializing is reversible"
+   (quickcheck
+     (property
+       ((octal $octal))
+       (test-when
+         (valid-octal? octal)
+         (equal?
+           (pk 'OCT octal)
+           (pk 'DECODE (serdeser -octal- octal)))))))

;;; (OCT #<<unstructured-octal> value: 0 source: #<<zero-string> value: "" trailer: "">>)

;;; (DECODE #<<unstructured-octal> value: 0 source: #<<zero-string> value: "" trailer: "">>)
Gave up! Passed only 1 est.
actual-value: #f
result: FAIL
--8<---------------cut here---------------end--------------->8---

This is more in line with what you described.  Any ideas on how to
address that?

Thanks,
Ludo’.