GNU bug report logs - #42111
tests/syscalls.scm stumbles on network interface aliases

Previous Next

Package: guix;

Reported by: Marius Bakke <marius <at> gnu.org>

Date: Sun, 28 Jun 2020 15:53:02 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


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

From: Marius Bakke <marius <at> gnu.org>
To: bug-guix <at> gnu.org
Subject: tests/syscalls.scm stumbles on network interface aliases
Date: Sun, 28 Jun 2020 17:52:20 +0200
[Message part 1 (text/plain, inline)]
Hello,

The "network-interface-names" test from tests/syscalls.scm fails if a
network interface alias is configured.

I.e. this command:

  ip addr add 127.0.0.2/8 dev lo label lo:lcat

causes the interface to show up in (network-interface-names), but not
(all-network-interface-names), breaking the test.

I could not find a procfs file that displays network aliases, so ISTM
we either need to add syscalls to check IFLA_IFALIAS, or simply ignore
interfaces with a colon (which seems to be required).

This patch does the latter and makes the test succeed:

[diff (text/x-patch, inline)]
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 6acaa0b131..7aa16ce3f4 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -382,7 +382,10 @@
      (member "lo" names))))
 
 (test-assert "network-interface-names"
-  (match (network-interface-names)
+  (match (filter (lambda (if)
+                   ;; Ignore interface aliases.
+                   (not (string-contains if ":")))
+                 (network-interface-names))
     (((? string? names) ..1)
      (lset<= string=? names (all-network-interface-names)))))
 
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 4 years and 326 days ago.

Previous Next


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