Fully functional cassandane with fewer patches.

Working with upstream I got some fixes pushed and found out about a
couple of other tricks.

Was able to drop some patches and now cassandane runs 603 tests
successfully.  The only tests excluded now are those which are expected
to fail with 3.0.1, and five coredump tests which would require removal
of systemd coredump redirection in order to be useful.
This commit is contained in:
Jason Tibbitts 2017-05-26 11:50:15 -05:00
parent e63a593c45
commit 9a65b5c93e
5 changed files with 89 additions and 116 deletions

View File

@ -32,16 +32,22 @@ destdir = BUILDROOT
# timsieved = yes # timsieved = yes
# backupd = yes # backupd = yes
#[config] [config]
altnamespace = no
unixhierarchysep = no
#[caldavtalk] #[caldavtalk]
#basedir = CASSDIR/cassandane/testdata #basedir = CASSDIR/cassandane/testdata
#[imaptest] [imaptest]
# XXX Cassandane wants this to not be installed. Don't know why. If # Cassandane wants this to not be installed. Don't know why. To use it we
# necessary, make a link farm to it. # have to make a directory and link things into it.
#basedir = /usr basedir = imaptest
#[caldavtester] # [jmaptester]
# basedir = JMAP-Tester
# The JMAP modules end up needing JSON-Typist (which I could bundle) and CryptX (which is a bit too much to bundle)
# [caldavtester]
# XXX Would need to include the source in the cyrus package just as cassandane is, and get it built before running tests # XXX Would need to include the source in the cyrus package just as cassandane is, and get it built before running tests
# basedir = ... # basedir = ...

View File

@ -1,7 +1,8 @@
# Cassandane doesn't have releases often. This was fetched on 20170523.
%global cmt1 b97ba9cbe78e48d10ee0cbdb1f43a73b907e3460
%define scmt(l:) %(c=%1; echo ${c:0:%{-l:%{-l*}}%{!-l:7}}) %define scmt(l:) %(c=%1; echo ${c:0:%{-l:%{-l*}}%{!-l:7}})
# Cassandane doesn't have releases often. This was fetched on 20170525.
%global cmt1 0a6c13e83813d4bb1ed4ee36ec7298c56db1b99b
# Cassandane run by default. '--without cassandane' disables. # Cassandane run by default. '--without cassandane' disables.
%bcond_without cassandane %bcond_without cassandane
@ -24,9 +25,6 @@ License: BSD
URL: http://www.cyrusimap.org/ URL: http://www.cyrusimap.org/
Source0: http://www.cyrusimap.org/releases/%name-%version.tar.gz Source0: http://www.cyrusimap.org/releases/%name-%version.tar.gz
# Allow master to run even if there's no cyrus user in /etc/passwd
Patch1: patch-neuter-become-cyrus
Source10: cyrus-imapd.logrotate Source10: cyrus-imapd.logrotate
Source11: cyrus-imapd.pam-config Source11: cyrus-imapd.pam-config
Source12: cyrus-imapd.sysconfig Source12: cyrus-imapd.sysconfig
@ -58,8 +56,8 @@ Source83: cassandane-redirect-syslog.c
# These are source files and not patches because you can't use autosetup to # These are source files and not patches because you can't use autosetup to
# apply patches to secondary unpacked source files. # apply patches to secondary unpacked source files.
Source90: patch-cassandane-no-sudo
Source91: patch-cassandane-no-syslog Source91: patch-cassandane-no-syslog
Source92: patch-cassandane-fix-annotator
# Dependency notes: # Dependency notes:
# * clamav-devel and mariadb-devel removed because they both depend on # * clamav-devel and mariadb-devel removed because they both depend on
@ -83,18 +81,21 @@ BuildRequires: xapian-core-devel
# Miscellaneous modules needed for 'make check' to function: # Miscellaneous modules needed for 'make check' to function:
BuildRequires: cyrus-sasl-plain cyrus-sasl-md5 BuildRequires: cyrus-sasl-plain cyrus-sasl-md5
BuildRequires: net-tools words
#BuildRequires: imaptest
%if %{with cassandane} %if %{with cassandane}
# Perl modules required for cassandane to function # Additional packages required for cassandane to function
BuildRequires: imaptest net-tools words
BuildRequires: perl(AnyEvent) perl(BSD::Resource) perl(Clone) BuildRequires: perl(AnyEvent) perl(BSD::Resource) perl(Clone)
BuildRequires: perl(File::chdir) perl(IO::Socket::INET6) perl(Mail::IMAPTalk) BuildRequires: perl(File::chdir) perl(IO::Socket::INET6) perl(Mail::IMAPTalk)
BuildRequires: perl(Config::IniFiles) perl(Mail::JMAPTalk) perl(Math::Int64) BuildRequires: perl(Config::IniFiles) perl(Mail::JMAPTalk) perl(Math::Int64)
BuildRequires: perl(Net::CalDAVTalk) perl(Net::CardDAVTalk) BuildRequires: perl(Net::CalDAVTalk) perl(Net::CardDAVTalk)
BuildRequires: perl(Net::Server) perl(News::NNTPClient) perl(String::CRC32) BuildRequires: perl(Net::Server) perl(News::NNTPClient) perl(Path::Tiny)
BuildRequires: perl(Sys::Syslog) perl(Test::Unit::TestRunner) perl(Time::HiRes) BuildRequires: perl(String::CRC32) perl(Sys::Syslog)
BuildRequires: perl(Test::Unit::TestRunner) perl(Time::HiRes)
BuildRequires: perl(Unix::Syslog) perl(XML::DOM) perl(XML::Generator) BuildRequires: perl(Unix::Syslog) perl(XML::DOM) perl(XML::Generator)
# These were only for JMAP-Tester
# perl(Moo), perl(Moose), perl(MooseX::Role::Parameterized) perl(Throwable), perl(Safe::Isa)
%endif %endif
Requires(pre): shadow-utils Requires(pre): shadow-utils
@ -134,11 +135,11 @@ hierarchies.
%package devel %package devel
Summary: Cyrus IMAP server development files Summary: Cyrus IMAP server development files
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %name%{?_isa} = %version-%release
Requires: pkgconfig Requires: pkgconfig
%description devel %description devel
The %{name}-devel package contains header files and libraries The %name-devel package contains header files and libraries
necessary for developing applications which use the imclient library. necessary for developing applications which use the imclient library.
@ -196,8 +197,8 @@ pushd cassandane
mkdir work mkdir work
tar xf %SOURCE81 tar xf %SOURCE81
patch -p1 < %SOURCE90
patch -p1 < %SOURCE91 patch -p1 < %SOURCE91
patch -p1 < %SOURCE92
cp %SOURCE82 cassandane.ini cp %SOURCE82 cassandane.ini
# RF rpm-buildroot-usage # RF rpm-buildroot-usage
sed -i \ sed -i \
@ -229,7 +230,9 @@ popd
# --with-cyrus-prefix and --with-service-path went away; use --with-libexecdir= # --with-cyrus-prefix and --with-service-path went away; use --with-libexecdir=
# instead. # instead.
#autoreconf -vi # Running autoreconf will confuse the program about what version it is.
# autoreconf -vi
%configure \ %configure \
--disable-silent-rules \ --disable-silent-rules \
\ \
@ -271,9 +274,6 @@ make notifyd/notifytest
# Also not built by default, but the tools are needed for serving timezone info # Also not built by default, but the tools are needed for serving timezone info
make -C tools/vzic make -C tools/vzic
#make -C man -f Makefile.dist
#make -C doc -f Makefile.dist
%install %install
make install DESTDIR=%buildroot make install DESTDIR=%buildroot
@ -306,9 +306,7 @@ for i in vzic vzic-test.pl vzic-merge.pl vzic-dump.pl; do
done done
# Install additional files # Install additional files
install -p -m 644 %SOURCE10 %buildroot/etc/logrotate.d/%name install -p -m 644 %SOURCE10 %buildroot/etc/logrotate.d/%name
install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/pop install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/pop
install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/imap install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/imap
install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/sieve install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/sieve
@ -316,16 +314,14 @@ install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/mupdate
install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/lmtp install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/lmtp
install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/nntp install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/nntp
install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/csync install -p -m 644 %SOURCE11 %buildroot/etc/pam.d/csync
install -p -m 644 %SOURCE12 %buildroot/etc/sysconfig/%name install -p -m 644 %SOURCE12 %buildroot/etc/sysconfig/%name
install -p -m 755 %SOURCE13 %buildroot/%cyrexecdir/cvt_cyrusdb_all
install -m 755 %SOURCE13 %buildroot/%cyrexecdir/cvt_cyrusdb_all install -p -m 644 %SOURCE14 %buildroot/%_datadir/%name/rpm/magic
install -m 644 %SOURCE14 %buildroot/%_datadir/%name/rpm/magic
install -p -m 755 %SOURCE15 %buildroot/etc/cron.daily/%name install -p -m 755 %SOURCE15 %buildroot/etc/cron.daily/%name
install -p -m 644 doc/examples/cyrus_conf/prefork.conf %buildroot/etc/cyrus.conf install -p -m 644 doc/examples/cyrus_conf/prefork.conf %buildroot/etc/cyrus.conf
install -p -m 644 doc/examples/imapd_conf/normal.conf %buildroot/etc/imapd.conf install -p -m 644 doc/examples/imapd_conf/normal.conf %buildroot/etc/imapd.conf
install -p -D -m 644 %SOURCE17 %buildroot/%_unitdir/cyrus-imapd.service
install -p -D -m 644 %SOURCE18 %buildroot/%_unitdir/cyrus-imapd-init.service
cat >> %buildroot/etc/imapd.conf <<END cat >> %buildroot/etc/imapd.conf <<END
@ -336,9 +332,6 @@ tls_key_file: /etc/pki/cyrus-imapd/cyrus-imapd-key.pem
tls_ca_file: /etc/pki/cyrus-imapd/cyrus-imapd-ca.pem tls_ca_file: /etc/pki/cyrus-imapd/cyrus-imapd-ca.pem
END END
install -p -D -m 644 %SOURCE17 %buildroot/%_unitdir/cyrus-imapd.service
install -p -D -m 644 %SOURCE18 %buildroot/%_unitdir/cyrus-imapd-init.service
# Cleanup of doc dir # Cleanup of doc dir
find doc perl -name CVS -type d -prune -exec rm -rf {} \; find doc perl -name CVS -type d -prune -exec rm -rf {} \;
find doc perl -name .cvsignore -type f -exec rm -f {} \; find doc perl -name .cvsignore -type f -exec rm -f {} \;
@ -359,14 +352,9 @@ find %buildroot/%_libdir/perl5/ -type f -name "*.so" -exec chmod 755 {} \;
# create the ghost pem file # create the ghost pem file
touch %buildroot/%ssl_pem_file touch %buildroot/%ssl_pem_file
## Cyrus has various files with extremely conflicting names. Some of these are # Cyrus has various files with extremely conflicting names. Some of these are
# not unexpected ("imapd" itself) but some like "httpd" are rather surprising. # not unexpected ("imapd" itself) but some like "httpd" are rather surprising.
# Where these files live in /usr/libexec and are not conflicting, they have
# been left alone even though this may cause a bit of confusion. Upstream
# intends to rename all potential conflict, and possibley just rename
# everything, to have a "cyr_" prefix. But this didn't happen for version 3.
# Where there are only conflicting manpages, they have been moved to a "8cyrus" # Where there are only conflicting manpages, they have been moved to a "8cyrus"
# section. If the binary was renamed, then the manpages are renamed to match # section. If the binary was renamed, then the manpages are renamed to match
# but a internal replacement has not been done. This may lead to more # but a internal replacement has not been done. This may lead to more
@ -390,7 +378,7 @@ mv %buildroot/%_mandir/man8/httpd.8 %buildroot/%_mandir/man8/cyr_httpd.8
#remove executable bit from docs #remove executable bit from docs
for ddir in doc perl/imap/examples for ddir in doc perl/imap/examples
do do
find $ddir -type f -exec chmod -x {} \; find $ddir -type f -ls -exec chmod -x {} \;
done done
# Remove pointless libtool archives # Remove pointless libtool archives
@ -406,50 +394,56 @@ find %buildroot -name ".packlist" -exec rm {} \;
make %{?_smp_mflags} check || exit 1 make %{?_smp_mflags} check || exit 1
%if %{with cassandane} %if %{with cassandane}
# Run the Cassandane test suite. This will exhaustively test the various
# server components, but running it in a mock chroot is rather an exercise.
pushd cassandane pushd cassandane
mkdir -p imaptest/src
ln -s /usr/bin/imaptest imaptest/src
ln -s /usr/share/imaptest/tests imaptest/src
# Build the syslog interposer # Build the syslog interposer
gcc -fPIC -shared -Wl,-soname,-libredirectsyslog.so.0 -ldl -o libredirectsyslog.so.0.0 redirect-syslog.c gcc -fPIC -shared -Wl,-soname,-libredirectsyslog.so.0 -ldl -o libredirectsyslog.so.0.0 redirect-syslog.c
# More work is required to get this going properly
export LD_LIBRARY_PATH=%buildroot/%_libdir export LD_LIBRARY_PATH=%buildroot/%_libdir
#./testrunner.pl %{?_smp_mflags} -f tap \ export CYRUS_USER=$USER
# -vvv \
# !Cassandane::Test::Core \
# ACL \
# 2>&1
# #!ACL \
# #!Admin \
#LD_LIBRARY_PATH=%buildroot/%_libdir ./testrunner.pl -j 16 --config cassandane.ini -f tap 2>&1
#exit 1
# Can't possibly work: # These are all the tests I have managed to make work at this time.
# Cassandane::Test::Core # Note that Cassandane::Test::Core must always be excluded; it can't possibly
# work. The others are expected on 3.0.1 and should be removed and re-checked
# at each release.
# Known OK tests: # Add -vvv for too much output
# Archive ./testrunner.pl %{?_smp_mflags} -f pretty \
# Backups !Cassandane::Test::Core \
# Bug3072 (slow) !Admin.imap_admins \
# Bug3470 !Fetch.fetch_flags_before_exists \
# Bug3649 !JMAPCalendars.getcalendarevents_properties \
# CaldavAlarm !JMAPCalendars.getcalendarevents_relatedto \
# Carddav !JMAPCalendars.getcalendarevents_simple \
# Conversations !JMAPCalendars.setcalendarevents_alerts \
# CyrusDB !JMAPCalendars.setcalendarevents_locations \
!JMAPCalendars.setcalendarevents_participants \
!JMAPCalendars.setcalendarevents_recurrenceoverrides \
!JMAPCalendars.setcalendarevents_relatedto \
!JMAPMail.getmessagelist_attachments \
!JMAPMail.getmessagelist_window \
!JMAPMail.getmessages_body_nontext \
!JMAPMail.getmessages_attachment_name \
!JMAPMail.setmailboxes_destroy_empty \
!Quota.num_folders_rename \
!SearchFuzzy.cjk_words \
!SearchFuzzy.xattachmentname \
2>&1
# Known bad tests: # ClamAV - we don't build with clamav yet.
# ACL (9 failures of 11) # TesterCalDAV - Would need to either package or bundle this.
# Admin (1 failure of 1) # TesterCardDAV - ^^
# Annotator (all tests error; very slow, problems running the annotator utility; problems with missing cyrus user) # TesterJMAP - Would need "jmaptester" from https://github.com/pobox/JMAP-TestSuite
# Autocreate (1 failure of 1) # It doesn't need to be installed so should be trivial.
# Bug3463
# Bug3903
# Caldav (just 3 failures out of 46 tests)
# Delete (all tests fail)
# ClamAV is probably not supported.
# No runnable tests: # No runnable tests:
# Cassandane::AnnotatorDaemon-# Annotator: patch utils/annotator.pl to pass the # Cassandane::AnnotatorDaemon-# Annotator: patch utils/annotator.pl to pass the

View File

@ -0,0 +1,14 @@
diff --git a/utils/annotator.pl b/utils/annotator.pl
index 94b84a2..0208831 100755
--- a/utils/annotator.pl
+++ b/utils/annotator.pl
@@ -140,6 +140,8 @@ GetOptions(
xlog "annotator $$ starting";
Cassandane::AnnotatorDaemon->run(
pid_file => $pidfile,
- port => $port
+ port => $port,
+ user => (getpwuid($<))[0],
+ group => (getgrgid($())[0],
);
xlog "annotator $$ exiting";

View File

@ -1,12 +0,0 @@
diff --git a/Cassandane/Util/Setup.pm b/Cassandane/Util/Setup.pm
index 3a67f0b..5a81e51 100644
--- a/Cassandane/Util/Setup.pm
+++ b/Cassandane/Util/Setup.pm
@@ -57,6 +57,7 @@ my @saved_argv = @ARGV;
sub become_cyrus
{
+ return 0;
my $cyrus = 'cyrus';
my $pw = getpwnam($cyrus);
die "No user named '$cyrus'"

View File

@ -1,29 +0,0 @@
diff --git a/lib/util.c b/lib/util.c
index 62ad7bd..37f0463 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -605,7 +605,7 @@ EXPORTED int become_cyrus(int is_master)
p = getpwnam(cyrus);
if (p == NULL) {
syslog(LOG_ERR, "no entry in /etc/passwd for user %s", cyrus);
- return -1;
+ return 0;
}
/* Save these in case initgroups does a getpw*() */
@@ -625,13 +625,13 @@ EXPORTED int become_cyrus(int is_master)
if (initgroups(cyrus, newgid)) {
syslog(LOG_ERR, "unable to initialize groups for user %s: %s",
cyrus, strerror(errno));
- return -1;
+ return 0;
}
if (setgid(newgid)) {
syslog(LOG_ERR, "unable to set group id to %d for user %s: %s",
newgid, cyrus, strerror(errno));
- return -1;
+ return 0;
}
result = cap_setuid(newuid, is_master);