FS#8565 - /etc/rc.d/postfix mutual conflict with Cyrus IMAPd

Attached to Project: Arch Linux
Opened by Ryan Corder (rcorder) - Thursday, 08 November 2007, 06:02 GMT
Last edited by Hugo Doria (hdoria) - Tuesday, 29 July 2008, 17:00 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Dale Blount (dale)
Paul Mattal (paul)
Architecture All
Severity Medium
Priority Normal
Reported Version 2007.08-2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

I maintain the Cyrus IMAP server package in AUR. Unfortunately, both Postfix and Cyrus IMAP both use a program named master as their main daemon. As a result, the 'pidof' program gets confused even though it shouldn't according to the pidof(8) man page.

A simple fix would be for both rc scripts to use 'pgrep -f' instead of 'pidof'. For instance, change the line:
PID=`pidof -o %PPID /usr/sbin/postfix/master`
to the following:
PID=`pgrep -f /usr/lib/postfix/master`
And I have made the change in Cyrus IMAP's rc script from:
PID=`pidof -o %PPID /usr/cyrus/bin/master`
to the following:
PID=`pgrep -f /usr/cyrus/bin/master`

with these changes, both programs can live peacefully together and users will be happy. I have made the change and uploaded the new version to AUR as revision 3 of Cyrus IMAP 2.3.9


Additional info:
* Postfix 2.4.6-1
* /etc/rc.d/postfix


Steps to reproduce:

If you install cyrus-imapd-2.3.9-2-i686.pkg.tar.gz from AUR, you will see how the two rc scripts conflict. If you start Postfix first, Cyrus IMAP will not start. If you start Cyrus IMAP first, Postfix will not start.
This task depends upon

Closed by  Hugo Doria (hdoria)
Tuesday, 29 July 2008, 17:00 GMT
Reason for closing:  Fixed
Comment by Ryan Corder (rcorder) - Wednesday, 16 January 2008, 21:47 GMT
any thoughts or updates?
Comment by Simon Bachmann (lupylucke) - Tuesday, 15 April 2008, 19:13 GMT
Not sure this is related, but the line
PID=`pidof -o %PPID /usr/sbin/postfix/master`
in /etc/rc.d/postfix is wrong. It should be
PID=`pidof -o %PPID /usr/lib/postfix/master`
otherwise stopping the daemon will fail. Maybe this resolves also the issue cited above?
Comment by Ryan Corder (rcorder) - Thursday, 17 April 2008, 05:56 GMT
I agree, it should have been that way, but changing it doesn't fix the problem. Per the pidof(8) man page:

When pidof is invoked with a full pathname to the program it should
find the pid of, it is reasonably safe. Otherwise it is possible that
it returns pids of running programs that happen to have the same name
as the program you're after but are actually other programs.

Unfortunately, if you change both the postfix and cyrus-master rc.d scripts back to using pidof, then whichever daemon you start second fails to start because pidof returns the PID of the other daemon's 'master' process and it thinks that it is already running.
Comment by Simon Bachmann (lupylucke) - Thursday, 17 April 2008, 19:27 GMT
I just patched killall5 (==pidof) with a patch from debian sid. My goal was not related with this issue - I was after the "-o pid" option - but if I understood things right, this patch also includes a fix to avoid getting a wrong pid when having programs with the same name.
I put that patch and a PKGBUILD on the AUR (http://aur.archlinux.org/packages.php?ID=16445).
This is pretty off-topic here, but maybe it might be a good idea to apply it to the sysvinit package on the core? Debian has several other patches for sysvinit that seem to do useful things, BTW (http://ftp.de.debian.org/debian/pool/main/s/sysvinit/sysvinit_2.86.ds1-56.diff.gz). given my poor knowledge in this field I just didn't feel brave enough to try them out all - Who knows what they might do to my system? :-)
Comment by Ryan Corder (rcorder) - Friday, 30 May 2008, 20:40 GMT
I noticed that the latest update to postfix is still using pidof and since pidof has not yet been patched to handle multiple processes of the same name, this bug is still around.

Any thoughts from the Postfix maintainer? I would be interested in hearing their thoughts on either pushing lupylucke's patch or switching the Postfix rc.d/ script to use pgrep.
Comment by Dale Blount (dale) - Friday, 30 May 2008, 20:42 GMT
Paul, any thoughts?
Comment by Glenn Matthys (RedShift) - Friday, 18 July 2008, 16:02 GMT
What's the status of this issue?
Comment by Hugo Doria (hdoria) - Tuesday, 29 July 2008, 17:00 GMT
Fixed in postfix-2.5.3-1!

Let me know if you find any problems related to this.

Loading...