On Sat, Mar 18, 2017 at 7:56 AM,  <jul...@fake-box.com> wrote:
> Package: diffutils
> Version: 3.5
>
> The test tests/brief-vs-stat-zero-kernel-lies fails with
>
>     cat: /proc/cmdline: Permission denied
>
> if /proc/cmdline exists but is not readable. This is for example the case on
> a Linux kernel with grsecurity patchset and option GRKERNSEC_PROC_USER
> enabled.
>
> The fix is easy. The script tests/brief-vs-stat-zero-kernel-lies checks in
> line 13 only for exists (test -f) of $boot (= /proc/cmdline):
>
>     test -f $boot || skip_ no $boot file
>
> making it check for readability (test -r) solves the problem (as the test is
> now correctly skipped):
>
>     test -r $boot || skip_ file $boot not readable

Thank you for the report and fix.

I propose to push this commit in your name. Since all I have for your
"real name" is "julama", that's what I've used in the commit "author:"
header. If you'd prefer something else, or a different email address,
let me know.
From 4c0f4ec27b2d572672bc8c0b783ff273c9cbd501 Mon Sep 17 00:00:00 2001
From: julama <jul...@fake-box.com>
Date: Wed, 22 Mar 2017 21:38:32 -0700
Subject: [PATCH] tests: avoid false failure for unreadable /proc/cmdline

* tests/brief-vs-stat-zero-kernel-lies: Use "test -r" rather than
just "test -f".  This avoids a false test failure on a linux system
with grsecurity and its GRKERNSEC_PROC_USER option enabled, for which
/proc/cmdline is unreadable.  Reported in https://bugs.gnu.org/26155
---
 tests/brief-vs-stat-zero-kernel-lies | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/brief-vs-stat-zero-kernel-lies 
b/tests/brief-vs-stat-zero-kernel-lies
index 7b043db..82b33e6 100755
--- a/tests/brief-vs-stat-zero-kernel-lies
+++ b/tests/brief-vs-stat-zero-kernel-lies
@@ -10,7 +10,7 @@ fail=0

 # Skip the test unless we have an appropriate file.
 boot=/proc/cmdline
-test -f $boot || skip_ no $boot file
+test -r $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

-- 
2.9.3

Reply via email to