Subject: bug#69518: test suite failures building Debian 1.4.0 packages

From: Vagrant Cascadian <[email-masked]>
Date: Sat, 02 Mar 2024 20:12:59 -0800

Several tests have started failing with builds of Guix in Debian:

  https://bugs.debian.org/1064748

My suspicion is I need to rebuild one of guix's build dependencies, but
I am not sure which one. Maybe all of them... Debian doesn't quite have
the same nice feature of always rebuilding everything that needs
rebuilding. :/

Digging through the referenced build log and also on a local build, the
following test failures seem to all fail in a similar way, with a
bytevecotr procedure(???):

test-name: fold-available-packages with/without cache
location: /<<PKGBUILDDIR>>/tests/packages.scm:1708
source:
+ (test-assert
+   "fold-available-packages with/without cache"
+   (let ()
+     (define no-cache
+       (fold-available-packages
+         (lambda* (name version result #:rest rest)
+           (cons (cons* name version rest) result))
+         '()))
+     (define from-cache
+       (call-with-temporary-directory
+         (lambda (cache)
+           (generate-package-cache cache)
+           (mock ((guix describe) current-profile (const cache))
+                 (mock ((gnu packages)
+                        cache-is-authoritative?
+                        (const #t))
+                       (fold-available-packages
+                         (lambda* (name version result #:rest rest)
+                           (cons (cons* name version rest) result))
+                         '()))))))
+     (define (list->set* lst)
+       (let loop ((lst lst) (duplicates '()) (seen (set)))
+         (match lst
+                (() (values seen duplicates))
+                ((head . tail)
+                 (if (set-contains? seen head)
+                   (loop tail (cons head duplicates) seen)
+                   (loop tail duplicates (set-insert head seen)))))))
+     (let ((set1 duplicates1 (list->set* from-cache))
+           (set2 duplicates2 (list->set* no-cache)))
+       (and (null? duplicates1)
+            (null? duplicates2)
+            (every (cut set-contains? set1 <>) no-cache)
+            (every (cut set-contains? set2 <>) from-cache)))))
actual-value: #f
actual-error:
+ (wrong-type-arg
+   "put-bytevector"
+   "Wrong type argument in position ~A (expecting ~A): ~S"
+   (2
+    "bytevector"
+    #<procedure 7fae69e26880 at system/vm/linker.scm:773:8 (port)>)
+   (#<procedure 7fae69e26880 at system/vm/linker.scm:773:8 (port)>))
result: FAIL

test-name: find-packages-by-name with cache
location: /<<PKGBUILDDIR>>/tests/packages.scm:1760
source:
+ (test-equal
+   "find-packages-by-name with cache"
+   (find-packages-by-name "guile")
+   (call-with-temporary-directory
+     (lambda (cache)
+       (generate-package-cache cache)
+       (mock ((guix describe) current-profile (const cache))
+             (mock ((gnu packages)
+                    cache-is-authoritative?
+                    (const #t))
+                   (find-packages-by-name "guile"))))))
expected-value: (#<package [email-masked] gnu/packages/guile.scm:392 7fae5c1b8d10> #<package [email-masked] gnu/packages/guile.scm:310 7fae5c1b8dc0> #<package [email-masked] gnu/packages/guile.scm:250 7fae5c1b8f20> #<package [email-masked] gnu/packages/guile.scm:297 7fae5c1b8e70> #<package [email-masked] gnu/packages/guile.scm:147 7fae5c1b2000> #<package [email-masked] gnu/packages/guile.scm:76 7fae5c1b20b0>)
actual-value: #f
actual-error:
+ (wrong-type-arg
+   "put-bytevector"
+   "Wrong type argument in position ~A (expecting ~A): ~S"
+   (2
+    "bytevector"
+    #<procedure 7fae6b40d800 at system/vm/linker.scm:773:8 (port)>)
+   (#<procedure 7fae6b40d800 at system/vm/linker.scm:773:8 (port)>))
result: FAIL

test-name: find-packages-by-name + version, with cache
location: /<<PKGBUILDDIR>>/tests/packages.scm:1769
source:
+ (test-equal
+   "find-packages-by-name + version, with cache"
+   (find-packages-by-name "guile" "2")
+   (call-with-temporary-directory
+     (lambda (cache)
+       (generate-package-cache cache)
+       (mock ((guix describe) current-profile (const cache))
+             (mock ((gnu packages)
+                    cache-is-authoritative?
+                    (const #t))
+                   (find-packages-by-name "guile" "2"))))))
expected-value: (#<package [email-masked] gnu/packages/guile.scm:250 7fae5c1b8f20> #<package [email-masked] gnu/packages/guile.scm:297 7fae5c1b8e70> #<package [email-masked] gnu/packages/guile.scm:147 7fae5c1b2000>)
actual-value: #f
actual-error:
+ (wrong-type-arg
+   "put-bytevector"
+   "Wrong type argument in position ~A (expecting ~A): ~S"
+   (2
+    "bytevector"
+    #<procedure 7fae40d6c880 at system/vm/linker.scm:773:8 (port)>)
+   (#<procedure 7fae40d6c880 at system/vm/linker.scm:773:8 (port)>))
result: FAIL

test-name: find-package-locations with cache
location: /<<PKGBUILDDIR>>/tests/packages.scm:1927
source:
+ (test-equal
+   "find-package-locations with cache"
+   (map (lambda (package)
+          (cons (package-version package)
+                (package-location package)))
+        (find-packages-by-name "guile"))
+   (call-with-temporary-directory
+     (lambda (cache)
+       (generate-package-cache cache)
+       (mock ((guix describe) current-profile (const cache))
+             (mock ((gnu packages)
+                    cache-is-authoritative?
+                    (const #t))
+                   (find-package-locations "guile"))))))
expected-value: (("3.0.8" . #<<location> file: "gnu/packages/guile.scm" line: 392 column: 2>) ("3.0.7" . #<<location> file: "gnu/packages/guile.scm" line: 310 column: 2>) ("2.2.7" . #<<location> file: "gnu/packages/guile.scm" line: 250 column: 2>) ("2.2.4" . #<<location> file: "gnu/packages/guile.scm" line: 297 column: 2>) ("2.0.14" . #<<location> file: "gnu/packages/guile.scm" line: 147 column: 2>) ("1.8.8" . #<<location> file: "gnu/packages/guile.scm" line: 76 column: 2>))
actual-value: #f
actual-error:
+ (wrong-type-arg
+   "put-bytevector"
+   "Wrong type argument in position ~A (expecting ~A): ~S"
+   (2
+    "bytevector"
+    #<procedure 7fae3f090880 at system/vm/linker.scm:773:8 (port)>)
+   (#<procedure 7fae3f090880 at system/vm/linker.scm:773:8 (port)>))
result: FAIL