Subject: Re: [bug-diffutils] bug#24121: new snapshot available: diffutils-3.3.52-e974

From: Jim Meyering <[email-masked]>
Date: Tue, 2 Aug 2016 09:46:24 -0700

On Mon, Aug 1, 2016 at 10:18 PM, Assaf Gordon <[email-masked]> wrote:
> Hello,
>
>> On Aug 1, 2016, at 12:44, Jim Meyering <[email-masked]> wrote:
>> Would you please see what the hurd test expected?
>> If you rerun it with this patch, the usual testsuite.log file will
>> include details:
>> <0001-k.diff>
>
> Digging a bit deeper, it seems that GNU Hurd does not have a functional /proc/self link
> (at least not Debian/Hurd 0.7).
>
>   $ uname -a
>   GNU hurd07 0.7 GNU-Mach 1.6+git20160114-486/Hurd-0.7 i686-AT386 GNU
>
>   $ ls -l /proc/self
>   lrwxrwxrwx 0 root root 1 Dec 31  1969 /proc/self -> 1
>
>   $ od -ta /proc/self/cmdline
>   0000000   i   n   i   t  sp   [   2   ] nul
>   0000011
>
> And so this test will never succeed as-is.
>
> A relevant mention of /proc/self shortcomings is here:
>  https://www.gnu.org/software/hurd/hurd/translator/procfs/jkoenig/discussion.html#index2h1

Thank you.
The attached patch should cause that test to be skipped when
/proc/self is not useful:
From 38e3a1dd49d6a2793eb990da60efae25a2ba1fcf Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Tue, 2 Aug 2016 09:30:06 -0700
Subject: [PATCH] tests: skip a /proc/self-dependent test on the Hurd

* tests/brief-vs-stat-zero-kernel-lies: The Hurd's /proc/self
is not useful, so detect that and skip the test that requires it.
Reported by Assaf Gordon in https://debbugs.gnu.org/24121#29
---
 tests/brief-vs-stat-zero-kernel-lies | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/brief-vs-stat-zero-kernel-lies b/tests/brief-vs-stat-zero-kernel-lies
index 9b272c6..7b043db 100755
--- a/tests/brief-vs-stat-zero-kernel-lies
+++ b/tests/brief-vs-stat-zero-kernel-lies
@@ -14,6 +14,14 @@ test -f $boot || skip_ no $boot file
 sz=$(stat --format %s $boot) || skip_ stat --format %s does not work
 test $sz = 0 || skip_ $boot has nonzero size

+# /proc/self is not useful on the Hurd, where it always points to "1",
+# so skip this test when /proc/self does not point to a file whose name is
+# the current process ID.
+readlink /proc/self > pid & pid=$!
+wait $pid
+echo $pid > exp
+compare exp pid || skip_ /proc/self is not useful on this system
+
 # There are two code paths to test: one for non-binary and one for binary files.
 # $boot is non-binary.
 cat $boot > ref || framework_failure_
-- 
2.8.0-rc2