On GNU/Hurd, error numbers are duplicated like this:

    $ ./src/getlimits | grep '^EPERM'       
    EPERM='Operation not permitted'
    EPERM='(os/kern) invalid address'
    EPERM='(ipc/rcv) receive in progress'
    EPERM='(ipc/send) send in progress'

When evaluating, the last one overrides the first one which is the one
we care about in the test suite. For example, we see test errors like
this because of this:

    + diff -u exp out
    --- exp 2026-09-09 06:01:03.000000000 +0100
    +++ out 2026-09-09 06:01:03.000000000 +0100
    @@ -1 +1 @@
    -chgrp: 'd/no-x': (ipc/send) no msg buffer
    +chgrp: 'd/no-x': Permission denied
    + fail=1

I have attached 2 patches which should each solve the issue
independently. I'm leaning towards the second one since it is the least
invasive. It simply ignores the error strings with these prefixes, since
they seem to be internal Mach stuff we don't care about:

    $ ./src/getlimits | grep -Eo '\(.*\)' | sort | uniq -c
         12 (ipc/rcv)
         16 (ipc/send)
         26 (os/kern)

The first one is tempting since it isn't platform specific, but it is
probably best to avoid the small chance of it causing issues.

Collin

diff --git a/init.cfg b/init.cfg
index 8bacb5d68..4a883b414 100644
--- a/init.cfg
+++ b/init.cfg
@@ -56,7 +56,7 @@ sanitize_path_()
 
 getlimits_()
 {
-  eval $(getlimits)
+  eval $(getlimits | sort -t= -k1,1 -u -s)
   test "$INT_MAX" || fatal_ "running getlimits"
 }
 
diff --git a/src/getlimits.c b/src/getlimits.c
index 514dd3c09..65b45dc8b 100644
--- a/src/getlimits.c
+++ b/src/getlimits.c
@@ -135,8 +135,16 @@ print_errno (void *name, int e)
 {
   char const *err_name = name ? name : strerrorname_np (e);
   if (err_name)
-    printf ("%s=%s\n", err_name,
-            quotearg_style (shell_escape_quoting_style, strerror (e)));
+    {
+      char const *err_str = strerror (e);
+#ifdef __gnu_hurd__
+      if (STRPREFIX (err_str, "(ipc/rcv)") || STRPREFIX (err_str, "(ipc/send)")
+          || STRPREFIX (err_str, "(os/kern)"))
+        return 0;
+#endif
+      printf ("%s=%s\n", err_name,
+              quotearg_style (shell_escape_quoting_style, err_str));
+    }
   return 0;
 }
 

Reply via email to