summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Varshavchik2022-01-22 12:06:50 -0500
committerSam Varshavchik2022-01-22 12:07:26 -0500
commit74a025c121b975b62f49acb6d1223f99630fc3dc (patch)
tree3498e1e045481cc9ddda201cf08a1edaacecfb92
parent7e17e85afdf4b5f1b093d9b53e20cb9e64d936bc (diff)
downloadcourier-libs-74a025c121b975b62f49acb6d1223f99630fc3dc.tar.bz2
imap: fixes to let make check be run as root.
-rw-r--r--imap/ChangeLog5
-rw-r--r--imap/Makefile.am8
-rw-r--r--imap/configure.ac5
-rwxr-xr-ximap/testsuite9
4 files changed, 21 insertions, 6 deletions
diff --git a/imap/ChangeLog b/imap/ChangeLog
index 7ca1cd0..f2df56d 100644
--- a/imap/ChangeLog
+++ b/imap/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-22 Sam Varshavchik <mrsam@courier-mta.com>
+
+ * Fixes to Makefile to workaround test suite failures related to
+ permission checking when make check runs as root.
+
2022-01-17 Sam Varshavchik <mrsam@courier-mta.com>
* Fix minor memory leaks.
diff --git a/imap/Makefile.am b/imap/Makefile.am
index 5d6b90d..8523af1 100644
--- a/imap/Makefile.am
+++ b/imap/Makefile.am
@@ -205,7 +205,7 @@ endif
check-am:
@test "@MAKECHECKBROKEN@" = "Y" || exit 0; echo "" ; echo "Error: --with-trashquota or the --enable-workarounds-for-imap-client-bugs" ; echo "option was specified to the configure script."; echo ""; echo "As INSTALL told you, make check fails if these options are used, and I wasn't"; echo "kidding when I wrote it. Reconfigure and rebuild without these options, then"; echo "rerun make and make check. If make check passes, reconfigure again with your"; echo "original options, and proceed with installing this server. Have fun!"; exit 1
- @cp /dev/null conftest1 ; chmod 000 conftest1 ; test -w conftest1 || \
+ @test "@rootcheck@" = "no" && exit 0; cp /dev/null conftest1 ; chmod 000 conftest1 ; test -w conftest1 || \
exit 0; echo "=============================" ; \
echo "Do not run make check as root" ; \
echo "=============================" ; exit 1
@@ -213,12 +213,12 @@ check-am:
@chmod +x testsuitefix.pl
LC_ALL=C; export LC_ALL; $(srcdir)/testsuite | ./testsuitefix.pl | sort | cmp -s - $(srcdir)/testsuite.txt
LC_ALL=C; export LC_ALL; test "@smap@" = "yes" || exit 0; @SHELL@ $(srcdir)/smaptestsuite | ./testsuitefix.pl | sort | cmp -s - $(srcdir)/smaptestsuite.txt
- VALGRIND="`which valgrind`"; test "$$VALGRIND" != "" || exit 0; \
+ VALGRIND="`which valgrind 2>/dev/null`"; test "$$VALGRIND" != "" || exit 0; \
LC_ALL=C; export LC_ALL; \
rm -f confmdtesterror; \
IMAPINVOKE='@SHELL@ $(srcdir)/testsuitevalgrind ./imapd'; export IMAPINVOKE; \
@SHELL@ -x $(srcdir)/testsuite 2>&1 | tee confmderror.txt; test -f confmdtesterror || exit 0; exit 1
- VALGRIND="`which valgrind`"; test "$$VALGRIND" != "" || exit 0; \
+ VALGRIND="`which valgrind 2>/dev/null`"; test "$$VALGRIND" != "" || exit 0; \
LC_ALL=C; export LC_ALL; \
rm -f confmdtesterror; \
IMAPINVOKE='@SHELL@ $(srcdir)/testsuitevalgrind ./imapd'; export IMAPINVOKE; \
@@ -228,7 +228,9 @@ check-am:
rm -rf confmdtest
testsuite-imap:
+ @chmod +x testsuitefix.pl
@LC_ALL=C; export LC_ALL; $(srcdir)/testsuite | ./testsuitefix.pl | sort
testsuite-smap:
+ @chmod +x testsuitefix.pl
@LC_ALL=C; export LC_ALL; test "@smap@" = "yes" || exit 0; @SHELL@ $(srcdir)/smaptestsuite | ./testsuitefix.pl | sort
diff --git a/imap/configure.ac b/imap/configure.ac
index 0d84dc6..2931cf3 100644
--- a/imap/configure.ac
+++ b/imap/configure.ac
@@ -68,6 +68,11 @@ AC_ARG_WITH(mailer,
)
AC_SUBST(SENDMAIL)
+AC_ARG_ENABLE(root-check, [ --disable-root-check Allow build as root (make check will fail)],
+ rootcheck="$enableval",
+ rootcheck="yes")
+AC_SUBST(rootcheck)
+
OPENSSL_PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin
AC_PATH_PROGS(OPENSSL, openssl, , $OPENSSL_PATH)
diff --git a/imap/testsuite b/imap/testsuite
index 2762ddd..ebca863 100755
--- a/imap/testsuite
+++ b/imap/testsuite
@@ -367,9 +367,12 @@ rm -rf confmdtest2
../maildir/maildirmake confmdtest2
../maildir/maildirmake -f a confmdtest2
../maildir/maildirmake -f b confmdtest2
-chmod u-rwx confmdtest2/.b/tmp
-chmod u-rwx confmdtest2/.b/new
-chmod u-rwx confmdtest2/.b/cur
+
+# This simulates inaccessible permissions. chmod 000 does not work as root.
+rm -rf confmdtest2/.b/*
+ln -s nonexistent confmdtest2/.b/tmp
+ln -s nonexistent confmdtest2/.b/cur
+ln -s nonexistent confmdtest2/.b/new
echo "test `pwd`/confmdtest2" >confmdtest/shared-maildirs