Improper call of "daemon" shell function in rc startup script leads to 
"dirname" error
--------------------------------------------------------------------------------------

                 Key: CORE-5069
                 URL: http://tracker.firebirdsql.org/browse/CORE-5069
             Project: Firebird Core
          Issue Type: Bug
          Components: Scripts
    Affects Versions: 2.5.5
         Environment: CentOS 6.7
            Reporter: Steve Friedl
            Priority: Minor


After installing FirebirdCS-2.5.5.26952-0.amd64.rpm on a CentOS 6.7 system and 
switching into SuperClassic mode, starting the service produces a script type 
error:

# service firebird start
Starting Firebird server [default] /usr/bin/dirname: extra operand `-daemon'
Try `/usr/bin/dirname --help' for more information.
                                                           [  OK  ]

This comes from /etc/rc.d/init.d/firebird here:

case "$1" in
  start)
        echo -n "Starting $FULLNAME "
        daemon --user=$FBRunUser "export FIREBIRD LD_LIBRARY_PATH; $GUARDIAN 
-pidfile $pidfile -daemon -forever"

The issue is that the daemon() shell function is trying to extract the actual 
executable name (which is $GUARDIAN) from the second parameter, but it's 
getting confused by the string, attempting to run dirname on te wrong thing. 
It's very confused.

This causes - among other things - the pid file not to be created properly, and 
the "service" infrastructure doesn't know if it's running or not.

The fix is to add a

  --check="$GUARDIAN"

parameter to the daemon line (I put it first), which provides the executable 
name so the shell function doesn't have to guess.

   daemon --check="$GUARDIAN" --user=$FBRunUser "export FIREBIRD 
LD_LIBRARY_PATH; $GUARDIAN -pidfile $pidfile -daemon -forever"

This /etc/rc.d/init.d/firebird script is pulled from the install bundle in 
/opt/firebird/misc/firebird.init.d.mandrake, and this is why I'm not submitting 
this as a patch.

The fix I mention works great on CentOS 6.7, but I have no idea if it works or 
breaks on Mandrake, or on other versions of Linux; this requires a bit more 
installation study that I can't do - I've never used and don't have Mandrake.

Looking in the svn logs, it appears that this behavior was changed to use the 
"daemon" shell function here:

     r43324 | alexpeshkoff | 2009-07-21 04:02:30 -0700 (Tue, 21 Jul 2009) | 2 
lines
     Updated startup script from Philippe Makowski

This is a suspiciously long time ago for this issue to appear to be unreported 
(I couldn't find it in the tracker), so I'm not sure what introduced the issue.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to