cyrusimap / cassandane

Other
6 stars 11 forks source link

syntax checking of annotator.pl broke cassandane tests in Fedora #96

Open landgraf opened 3 years ago

landgraf commented 3 years ago

In Fedora (as well as RHEL and I assume other distributions) cassandane tests are run against cyrus-imapd which was built but not installed. Since commit ab914978aaf2e6fdc169f9742f923940eb55069d this no longer works and failed with error: Base class package "Cyrus::Annotator::Daemon" is empty. (Perhaps you need to 'use' the module which defines that package first, or make that module available in @INC (@INC contains: /builddir/build/BUILDROOT/cyrus-imapd-3.2.4-1.fc34.x86_64/usr/share/perl5/vendor_perl /builddir/build/BUILDROOT/cyrus-imapd-3.2.4-1.fc34.x86_64/usr/lib64/perl5/vendor_perl /builddir/build/BUILDROOT/cyrus-imapd-3.2.4-1.fc34.x86_64/usr/share/perl5/5.32 /builddir/build/BUILDROOT/cyrus-imapd-3.2.4-1.fc34.x86_64/usr/lib64/perl5/5.32 /usr/local/lib64/perl5/5.32 /usr/local/share/perl5/5.32 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5). at ./utils/annotator.pl line 45.

elliefm commented 3 years ago

utils/annotator.pl always fails a perl -c check like this if the Cyrus perl modules aren't installed. We used to simply not syntax check it at all, but now we use the Cyrus paths configured in cassandane.ini to locate the Cyrus installation so that we can.

I guess if cassandane.ini is configured to use a Cyrus source tree rather than an install tree, then the install-time perl hooks haven't run. The perl files in the source tree are not the same thing as what's actually installed.

The first line of make output in this case should be something like "warning: Cyrus perl paths not found on disk. Is Cyrus installed?" -- do you see that?

landgraf commented 3 years ago

The first line of make output in this case should be something like "warning: Cyrus perl paths not found on disk. Is Cyrus installed?" -- do you see that?

Yes, I do.

+ pushd cassandane
+ make
warning: Cyrus perl paths not found on disk.  Is Cyrus installed?
make[1]: Entering directory '/builddir/build/BUILD/cyrus-imapd-3.2.4/cassandane-e417da617e38e80035c777dc4ac1e191e21ad269/utils'
gcc -g -O0 -Wall -Wextra -fPIC   -c -o lemming.o lemming.c
gcc -g -O0 -Wall -Wextra -fPIC    -o lemming lemming.o
gcc -g -O0 -Wall -Wextra -fPIC   -c -o gdbtramp.o gdbtramp.c
gcc -g -O0 -Wall -Wextra -fPIC    -o gdbtramp gdbtramp.o
gcc -g -O0 -Wall -Wextra -fPIC   -c -o crash.o crash.c
gcc -g -O0 -Wall -Wextra -fPIC    -o crash crash.o
gcc -g -O0 -Wall -Wextra -fPIC   -c -o syslog_probe.o syslog_probe.c
gcc -g -O0 -Wall -Wextra -fPIC    -o syslog_probe syslog_probe.o
gcc -g -O0 -Wall -Wextra -fPIC   -c -o syslog.o syslog.c
gcc -g -O0 -Wall -Wextra -fPIC    -shared -o syslog.so syslog.o -ldl
make[1]: Leaving directory '/builddir/build/BUILD/cyrus-imapd-3.2.4/cassandane-e417da617e38e80035c777dc4ac1e191e21ad269/utils'
./genmail3.pl syntax OK
./imap-append.pl syntax OK
./jenkins-xml-summary.pl syntax OK
./listmail.pl syntax OK
./pop3showafter.pl syntax OK
./split-by-thread.pl syntax OK
./sprinkle.pl syntax OK
./start-instance.pl syntax OK
./testrunner.pl syntax OK
Base class package "Cyrus::Annotator::Daemon" is empty.
    (Perhaps you need to 'use' the module which defines that package first,
    or make that module available in @INC (@INC contains: /builddir/build/BUILDROOT/cyrus-imapd-3.2.4-2.fc34.x86_64/usr/share/perl5/vendor_perl /builddir/build/BUILDROOT/cyrus-imapd-3.2.4-2.fc34.x86_64/usr/lib64/perl5/vendor_perl /builddir/build/BUILDROOT/cyrus-imapd-3.2.4-2.fc34.x86_64/usr/share/perl5/5.32 /builddir/build/BUILDROOT/cyrus-imapd-3.2.4-2.fc34.x86_64/usr/lib64/perl5/5.32 /usr/local/lib64/perl5/5.32 /usr/local/share/perl5/5.32 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5).
 at ./utils/annotator.pl line 45.
BEGIN failed--compilation aborted at ./utils/annotator.pl line 45.
make: *** [Makefile:63: utils/annotator.pl_syntax] Error 255
error: Bad exit status from /var/tmp/rpm-tmp.6pLd7s (%build)
elliefm commented 3 years ago

So, since the Cyrus directory here is a source tree rather than an install tree, and the utils/annotator.pl can never compile successfully because the perl modules it wants are not in an installed state, then I guess it must also be suppressing all the Annotator tests in cassandane.ini? Because it seems like they could never pass in this configuration.

I've had a think about how I might detect this case and skip syntax-checking the annotator.pl file after all, but given that this is a Makefile, it's gonna be messy and precarious at best...

Can you have the package patch Cassandane with something like this before it runs make?

diff --git a/Makefile b/Makefile
index 3802137..e7b7070 100644
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,7 @@ all clean install::

 all:: syntax

-SCRIPTS := $(shell find . -type f -name '*.pl' | sort)
+SCRIPTS := $(shell find . -type f -name '*.pl' | grep -v 'utils\/annotator.pl' | sort)

 MODULES := $(shell find . -type f -name '*.pm' | sort)

It won't fix anything (it can't), but it will restore the previous behaviour of skipping the syntax checks of utils/annotator.pl, since you already know it can't possibly succeed in this setup.