Subject: bug#70866: panic-tests.sh test fails when run as root

From: Bruno Haible <[email-masked]>
Date: Sat, 11 May 2024 00:12:27 +0200

I wrote:
> The attached patch fixes it.

The same problem exists also on Cygwin. Here's a patch that fixes it for
both cases (and obsoletes the previous patch).

>From f4f6f2086eb602da3a9c528a287156c3f2787145 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email-masked]>
Date: Fri, 10 May 2024 20:40:32 +0200
Subject: [PATCH] tests: avoid test failure when running as root or in Cygwin

* testsuite/panic-tests.sh: When running as root or in Cygwin, skip the test.
---
 testsuite/panic-tests.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/testsuite/panic-tests.sh b/testsuite/panic-tests.sh
index 85aeec5..0244d92 100644
--- a/testsuite/panic-tests.sh
+++ b/testsuite/panic-tests.sh
@@ -27,6 +27,13 @@ mkdir a || framework_failure_
 touch a/a || framework_failure_
 chmod a-w a || framework_failure_
 
+# skip the test when running as root or when running in Cygwin
+# (because in these cases, the directory is still actually writable)
+test `id -u` != 0 || skip_ 'running as root'
+case `uname -s` in
+  CYGWIN*) skip_ 'running in cygwin' ;;
+esac
+
 # Expected error message, with actual filename/errno trimmed
 cat <<\EOF >exp-err-temp || framework_failure_
 sed: couldn't open temporary file
-- 
2.34.1