Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 103014 - Courier-authlib fails to start with baselayout-1.12.0_pre5. Other daemons may be affected as well.
Summary: Courier-authlib fails to start with baselayout-1.12.0_pre5. Other daemons may...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Scott Taylor (RETIRED)
URL:
Whiteboard:
Keywords:
: 103602 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-08-18 15:28 UTC by Miroslaw Poray-Zbrozek
Modified: 2005-08-24 14:35 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miroslaw Poray-Zbrozek 2005-08-18 15:28:31 UTC
After upgrading to baselayout-1.12.0_pre5 on one of my servers I discovred that
I was unable to start any courier-imap daemons any more. The reason was that
courier-authlib will not start with this version of baselayout and all the other
courier processes depend on that.

Reproducible: Always
Steps to Reproduce:
1. # emerge -u "=sys-apps/baselayout-1.12.0_pre5"
2. # reboot
3. # /etc/init.d/courier-authlib start

Actual Results:  
The last command printed out the following error message:
   pidof: invalid options on command line!
and the daemon did not start (ps aux reports no authdaemon processes)

Expected Results:  
The daemon should have been started successfuly which can be checked e.g. with:
  # ps aux | grep authdaemon
This should report a number (the actual number depends on the
/etc/courier/authlib/authdaemonrc settings) of daemons listening for
authentication requests.

It seems that the reason for that problem stems from the method used to compute
the pids related to a particular daemon. Those operations are performed in the
/lib/rcscripts/sh/rc-daemon.sh file. The method used fetches the command line
arguments from the daemon invoation and feeds them into pidof. This method
assumes that those arguments that are program names will return the relevant
pids, those that are something else will return nothing. What has been
overlooked is the pidof behavior. When an argument begins with a minus sign it
returns an error message as mentioned earlier. A quck fix for this problem would
be to add a line that reads as the following:
  args=`echo $args | sed "s/'-\+/'/g"`
before the pidof invocation on line 191:
  eval /bin/pidof -x ${args}
The additional line strips the leading minus signs from the parameters which
fixes the problem.

I have encountered that problem only when trying to start Courier Imap but I
suspect that other daemons may be affected as well.
Comment 1 Julian Sasse 2005-08-18 19:26:47 UTC
I can verify that this problem also occurs with the new 1.12.0_pre6 version of
baselayout:
# /etc/init.d/courier-authlib start
 * Starting courier-authlib: authdaemond ...
pidof: invalid options on command line!
[ !! ]

This is with the following package versions:
sys-apps/baselayout-1.12.0_pre6
net-libs/courier-authlib-0.57
net-mail/courier-imap-4.0.4

Please also see Bug 98745
(apparently the newer baselayout's causes problems with "courier-authlib" +
"courier-imap" but not with the full "courier" package, although I have not
tested the latter myself)
Comment 2 Joseph LeBlanc 2005-08-19 13:46:35 UTC
I am aswell getting this error with 1.12.0_pre5 and 1.12.0_pre6 of baselayout

 * Starting courier-authlib: authdaemond ...
pidof: invalid options on command line!
                                                                          [ !! ]

Im thinking in the source in 'start-stop-daemon' the pidof command has the wrong
argument?
Comment 3 Miroslaw Poray-Zbrozek 2005-08-22 15:32:36 UTC
I can confirm that baselayout-1.12.0_pre6 still behaves the same way and the
same workaround in /lib/rcscripts/sh/rc-daemon.sh fixes it.
Comment 4 Roy Marples (RETIRED) gentoo-dev 2005-08-23 08:12:25 UTC
Could someone test editing the courier-authlib init script and changing line 30
to read

/usr/bin/env $logger -- -pid="$pidfile" -start "${AUTHLIB}/${AUTHDAEMOND}"

I don't think that rc-daemon.sh is at fault here - it's the faulty calling of
start-stop-daemon again.
Comment 5 Miroslaw Poray-Zbrozek 2005-08-23 10:26:16 UTC
I changed line # 30 in /etc/init.d/courier-authlib according to your suggestion
and it does fix the problem. Courier Authlib now starts without any problem with
the unaltered rc-daemon.sh from baselayout-1.12.0_pre6 (meantime I updated my
baselayout but the same should be the case with 1.12.0_pre5).
Comment 6 Bjarke Istrup Pedersen (RETIRED) gentoo-dev 2005-08-23 10:33:53 UTC
If I manually runs this, it starts fine, so it has to be something with 
baselayout.

jupiter ~ # source /etc/courier/authlib/authdaemonrc
jupiter ~ # AUTHLIB="/usr/lib/courier/courier-authlib"
jupiter ~ # AUTHDAEMOND="authdaemond"
jupiter ~ # pidfile="/var/run/authdaemon.pid"
jupiter ~ # logger="/usr/sbin/courierlogger"
jupiter ~ # start-stop-daemon --quiet --start --pidfile "$pidfile" --
exec /usr/bin/env -- - $logger -pid="$pidfile" -start "${AUTHLIB}/
${AUTHDAEMOND}"
jupiter ~ # cd /var/lib/init.d/started/
jupiter started # ln -s /etc/init.d/courier-authlib

Then I can start courier, since it sees courier-authlib as if it was started 
by init.
Comment 7 Bjarke Istrup Pedersen (RETIRED) gentoo-dev 2005-08-23 10:37:23 UTC
(In reply to comment #4)
> Could someone test editing the courier-authlib init script and changing line 
30
> to read
> /usr/bin/env $logger -- -pid="$pidfile" -start "${AUTHLIB}/${AUTHDAEMOND}"
> I don't think that rc-daemon.sh is at fault here - it's the faulty calling of
> start-stop-daemon again.

That works fine :-)
Comment 8 Roy Marples (RETIRED) gentoo-dev 2005-08-24 01:37:09 UTC
Fixed in 0.57-r1 - or just re-emerge your current version.
Comment 9 Jakub Moc (RETIRED) gentoo-dev 2005-08-24 14:35:45 UTC
*** Bug 103602 has been marked as a duplicate of this bug. ***