68 lines
2.6 KiB
Diff
68 lines
2.6 KiB
Diff
From f7333277c2709b147e2f2a3ab357ec3a195fb1f5 Mon Sep 17 00:00:00 2001
|
|
From: Chris Dunlap <cdunlap@llnl.gov>
|
|
Date: Fri, 4 Dec 2020 21:31:34 -0800
|
|
Subject: [PATCH 2/4] Sharness: Fix dup of failing check when run by root
|
|
|
|
When the test suite is run by root, the following two failures occur in
|
|
"0103-munged-security-logfile.t":
|
|
|
|
10 - logfile not writable by user failure
|
|
31 - logfile failure writes single message to stderr
|
|
|
|
This second test, "logfile failure writes single message to stderr",
|
|
checks for a regression of a duplicate error message being written to
|
|
stderr by forcing an expected failure -- namely, setting the logfile
|
|
perms to 0400 and expecting an error when opening the logfile because
|
|
the user does not have write-permissions. This expected failure is
|
|
the check being performed in the first test, "logfile not writable
|
|
by user failure".
|
|
|
|
Fix the test for "logfile failure writes single message to stderr"
|
|
by forcing a different error that is not affected by root privileges.
|
|
In particular, set the logfile perms to 0602 which will fail because
|
|
the logfile is now writable by other; this will fail regardless of
|
|
whether or not the user is root.
|
|
|
|
Tested:
|
|
- Arch Linux
|
|
- CentOS Stream 8, 8.3.2011, 7.9.2009, 6.10
|
|
- Debian sid, 10.8, 9.13, 8.11, 7.11, 6.0.10, 5.0.10, 4.0
|
|
- Fedora 33, 32, 31
|
|
- FreeBSD 12.2, 11.4
|
|
- NetBSD 9.1, 9.0, 8.1
|
|
- OpenBSD 6.8, 6.7, 6.6
|
|
- openSUSE 15.2, 15.1
|
|
- Raspberry Pi OS (Raspbian 10) [armv7l]
|
|
- Ubuntu 20.10, 20.04.2 LTS, 18.04.5 LTS, 16.04.7 LTS, 14.04.6 LTS, 12.04.5 LTS
|
|
---
|
|
t/0103-munged-security-logfile.t | 8 +++++---
|
|
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/t/0103-munged-security-logfile.t b/t/0103-munged-security-logfile.t
|
|
index fafd973..40b59a6 100755
|
|
--- a/t/0103-munged-security-logfile.t
|
|
+++ b/t/0103-munged-security-logfile.t
|
|
@@ -343,14 +343,16 @@ test_expect_success 'logfile dir writable by other with sticky bit' '
|
|
chmod 0755 "${MUNGE_LOGDIR}"
|
|
'
|
|
|
|
-# Check for a regression of a duplicate error message being written to stderr
|
|
-# for a failure to open the logfile.
|
|
+# Check for a regression of a duplicate error message being written to stderr.
|
|
+# To generate an error, test for the logfile being writable by other since this
|
|
+# will not be affected by root privileges.
|
|
+#
|
|
##
|
|
test_expect_success 'logfile failure writes single message to stderr' '
|
|
local ERR NUM &&
|
|
rm -f "${MUNGE_LOGFILE}" &&
|
|
touch "${MUNGE_LOGFILE}" &&
|
|
- chmod 0400 "${MUNGE_LOGFILE}" &&
|
|
+ chmod 0602 "${MUNGE_LOGFILE}" &&
|
|
test_must_fail munged_start_daemon t-keep-logfile 2>err.$$ &&
|
|
cat err.$$ &&
|
|
ERR=$(sed -n -e "s/.*Error: //p" err.$$ | sort | uniq -c | sort -n -r) &&
|
|
--
|
|
2.30.0
|
|
|