all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#45716: Bug in ‘network-interface-names’ when building guix for aarch64 on x86_64.
@ 2021-01-07 15:37 Stefan
  2021-01-07 22:17 ` Stefan
  0 siblings, 1 reply; 18+ messages in thread
From: Stefan @ 2021-01-07 15:37 UTC (permalink / raw)
  To: 45716

Hi!

When building for aarch64 on a x86…64 system, then the ‘network-interface-names’ function produces an error.

Because of this building guix for aarch64 fails during the test with this:

test-name: network-interface-names
location: /tmp/guix-build-guix-1.2.0-8.7624ebb.drv-0/source/tests/syscalls.scm:387
source:
+ (test-assert
+   "network-interface-names"
+   (match (remove
+            (lambda (interface)
+              (string-contains interface ":"))
+            (network-interface-names))
+          (((? string? names) ..1)
+           (lset<=
+             string=?
+             names
+             (all-network-interface-names)))))
actual-value: #f
actual-error:
+ (wrong-type-arg
+   "list-tail"
+   "Wrong type argument in position ~A (expecting ~A): ~S"
+   (1 "pair" ())
+   (()))
result: FAIL


I created a little reproducer for this problem:

stefan@guix ~$ cat test.scm 
(use-modules (guix gexp)
             (gnu packages admin))
(with-imported-modules '((guix build syscalls)
                         (guix build utils))
  (computed-file "insterface-names"
    #~(begin
        (use-modules (guix build syscalls)
                     (guix build utils)
                     (ice-9 popen)
                     (ice-9 rdelim))
        (mkdir-p #$output)
        (chdir #$output)
        (with-output-to-file "interface-names"
          (lambda ()
            (display (string-join (all-network-interface-names) ", "))
            (newline)
            (let* ((port (open-input-pipe #$(file-append inetutils "/bin/ifconfig"))))
              (display (string-join 
                        (let loop ((output '()))
                          (let ((line (read-line port)))
                            (if (eof-object? line)
                              (reverse output)
                              (loop (cons line output)))))
                        "\n"))
              (close-pipe port))
            (display (string-join (network-interface-names) ", "))
            (newline))))))

stefan@guix ~$ guix build --system=aarch64-linux -f test.scm 
Folgende Ableitung wird erstellt:
   /gnu/store/l7sypckaywl3djrhagywwzsb2c3984wf-insterface-names.drv
/gnu/store/l7sypckaywl3djrhagywwzsb2c3984wf-insterface-names.drv wird erstellt …
Backtrace:
           7 (primitive-load "/gnu/store/a37szh4h151v66xyl874qfcbm6x?")
In ice-9/ports.scm:
   463:17  6 (call-with-output-file _ _ #:binary _ #:encoding _)
    474:4  5 (_ _)
In ice-9/eval.scm:
    619:8  4 (_ #(#(#<directory (guile-user) 7ffff6f14f00>)))
    155:9  3 (_ #(#(#<directory (guile-user) 7ffff6f14f00>)))
    159:9  2 (_ #(#(#<directory (guile-user) 7ffff6f14f00>)))
In guix/build/syscalls.scm:
  1476:13  1 (bytevector->string-list _ 40 _)
In unknown file:
           0 (list-tail (108 111 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 ?) ?)

ERROR: In procedure list-tail:
In procedure list-tail: Wrong type argument in position 1 (expecting pair): ()
builder for `/gnu/store/l7sypckaywl3djrhagywwzsb2c3984wf-insterface-names.drv' failed with exit code 1
Erstellung von /gnu/store/l7sypckaywl3djrhagywwzsb2c3984wf-insterface-names.drv fehlgeschlagen
Das Erstellungsprotokoll kann unter „/var/log/guix/drvs/l7/sypckaywl3djrhagywwzsb2c3984wf-insterface-names.drv.bz2“ eingesehen werden.
guix build: error: build of `/gnu/store/l7sypckaywl3djrhagywwzsb2c3984wf-insterface-names.drv' failed


When the line containing "(display (string-join (network-interface-names) ", "))" is removed, the output looks as follows:

stefan@guix ~$ cat /gnu/store/q7m7dxp4pn7jrw4f6hkwfsiga5zj43x1-insterface-names/interface-names 
lo
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Bcast:0.0.0.0  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0  TX bytes:0

I think the problem happens in guix/build/syscalls.scm in ‘bytevector->string-list’, which is used by ‘network-interface-name’, certainly in (drop bytes stride) more bytes than available should be dropped, probably because stride is bigger than len:

(define (bytevector->string-list bv stride len)
  "Return the null-terminated strings found in BV every STRIDE bytes.  Read at
most LEN bytes from BV."
  (let loop ((bytes  (take (bytevector->u8-list bv)
                           (min len (bytevector-length bv))))
             (result '()))
    (match bytes
      (()
       (reverse result))
      (_
=>     (loop (drop bytes stride)
             (cons (bytes->string bytes) result))))))


Bye

Stefan



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-02-08 15:41 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-07 15:37 bug#45716: Bug in ‘network-interface-names’ when building guix for aarch64 on x86_64 Stefan
2021-01-07 22:17 ` Stefan
2021-01-08  3:04   ` Danny Milosavljevic
2021-01-08 13:33     ` Stefan
2021-01-08 16:47     ` Stefan
2021-01-08 23:28       ` Stefan
2021-01-09 18:01         ` bug#45716: gnu: qemu: Fix ioclt(…, SIOCGIFCONF, …) for emulated 64 bit architectures Stefan
2021-01-11 13:28           ` Ludovic Courtès
2021-01-11 20:32             ` bug#45716: [PATCH 1/1] " Stefan
2021-01-14 13:39               ` Ludovic Courtès
2021-01-23 15:27                 ` bug#45716: Bug in ‘network-interface-names’ when building guix for aarch64 on x86_64 Stefan
2021-01-23 20:13                   ` Leo Famulari
2021-02-01 20:58                     ` Ludovic Courtès
2021-02-02  8:09                       ` Mathieu Othacehe
2021-02-06 12:59                         ` Stefan
2021-02-07 18:15                           ` Mathieu Othacehe
2021-02-08  7:44                             ` Stefan
2021-01-11 13:30     ` 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.