bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45716: Bug in ‘network-interface-names’ when building guix for aarch


From: Stefan
Subject: bug#45716: Bug in ‘network-interface-names’ when building guix for aarch64 on x86_64.
Date: Thu, 7 Jan 2021 16:37:56 +0100

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]