Hi Jim,

The continuous integration at https://gitlab.com/gnu-gzip/ci-distcheck/
shows a test failure:

FAIL: write-error
=================
../../../sources/gzip/build-aux/test-driver: line 107: 
../../../sources/gzip/tests/write-error: Permission denied
FAIL write-error (exit status: 126)

A simple 'chmod a+x tests/write-error' fixes this one, for non-root
users.

When I run "make check" as root — which happens to be what the CI does —
I get another test failure:

FAIL write-error (exit status: 1)

The reason here is that even after 'chmod a-w d', the directory 'd'
is writable.

This patch fixes both issues. "make check" now passes again, both as a
normal user and as root.


>From 5520631bafe004aead6db710e66de2cf43fc0a80 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Tue, 11 Apr 2023 19:10:29 +0200
Subject: [PATCH] tests: Fix a test failure.

* tests/write-error: Make executable. Skip the test if we're running as root.
---
 tests/write-error | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 tests/write-error

diff --git a/tests/write-error b/tests/write-error
old mode 100644
new mode 100755
index 150c162..1f3a7f1
--- a/tests/write-error
+++ b/tests/write-error
@@ -24,7 +24,11 @@ fail=0
 mkdir d || framework_failure_
 echo > d/f || framework_failure_
 chmod a-w d || framework_failure_
-
-returns_ 1 gzip d/f > out 2> err || fail=1
+if test -w d; then
+  echo >&2 "$0: being root, skipping this test"
+  fail=77
+else
+  returns_ 1 gzip d/f > out 2> err || fail=1
+fi
 
 Exit $fail
-- 
2.34.1

Reply via email to