Subject: bug#70862: closed (Re: bug#70862: 'write-error' test fails on NetBSD when run as root)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 11 May 2024 19:47:02 +0000

Your bug report

#70862: 'write-error' test fails on NetBSD when run as root

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

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

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

Subject: Re: bug#70862: 'write-error' test fails on NetBSD when run as root
From: Paul Eggert <[email-masked]>
To: Bruno Haible <[email-masked]>
Cc: [email-masked]
Date: Sat, 11 May 2024 12:46:40 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks, I installed that fix.

Subject: 'write-error' test fails on NetBSD when run as root
From: Bruno Haible <[email-masked]>
To: [email-masked]
Date: Fri, 10 May 2024 18:01:56 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

On NetBSD, building gzip from git (with the newest gnulib) and
running "make check" as root produces 1 test failure:

FAIL: write-error
=================

FAIL write-error (exit status: 1)

How to reproduce:
1. Download tarball.zip from
   https://github.com/gnu-gzip/ci-check/actions/runs/9033181872/artifacts/1491311737
2. Unpack it.
3. tar xfz gzip-2024-05-10.tar.gz
4. ./configure; make; make check

The attached patch fixes it (and produces no regressions).

>From 4241ba74e6ec9393f467e9bf1e51ab7147db3b21 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email-masked]>
Date: Fri, 10 May 2024 17:38:18 +0200
Subject: [PATCH] tests: Fix test failure on NetBSD when run as root.

* tests/write-error: Also test whether the process is running under uid 0.
---
 tests/write-error | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/write-error b/tests/write-error
index de8b557..b53eddb 100755
--- a/tests/write-error
+++ b/tests/write-error
@@ -24,7 +24,7 @@ fail=0
 mkdir d || framework_failure_
 echo > d/f || framework_failure_
 chmod a-w d || framework_failure_
-if test -w d; then
+if test -w d || test `id -u` = 0; then
   echo >&2 "$0: being root, skipping this test"
   fail=77
 else
-- 
2.34.1