Subject: bug#42111: closed (Re: bug#42111: tests/syscalls.scm stumbles on network interface aliases)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 28 Jun 2020 21:38:01 +0000

Your bug report

#42111: tests/syscalls.scm stumbles on network interface aliases

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
42111: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=42111
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#42111: tests/syscalls.scm stumbles on network interface aliases
From: Marius Bakke <[email-masked]>
To: Ludovic Courtès <[email-masked]>
Cc: [email-masked]
Date: Sun, 28 Jun 2020 23:37:07 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Ludovic Courtès <[email-masked]> writes:

>> 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.
>
> Perhaps add “since they don’t show up in (all-network-interface-names)”.
>
>> +                   (not (string-contains if ":")))
>> +                 (network-interface-names))
>
> You can use ‘remove’ instead of ‘filter’ + ‘not’.

ah, much clearer with those suggestions, thanks!

Pushed in 5e113cf4424b2746cbf3633cd2106c62b89e5b49.

Subject: tests/syscalls.scm stumbles on network interface aliases
From: Marius Bakke <[email-masked]>
To: [email-masked]
Date: Sun, 28 Jun 2020 17:52:20 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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 --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)))))