directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "alex alvarez (JIRA)" <j...@apache.org>
Subject [jira] Created: (DIRSERVER-1365) Modification on the current init script (at least version 1.5.4) placed under /etc/init.d
Date Wed, 06 May 2009 20:06:31 GMT
Modification on the current init script (at least version 1.5.4) placed under /etc/init.d
-----------------------------------------------------------------------------------------

                 Key: DIRSERVER-1365
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1365
             Project: Directory ApacheDS
          Issue Type: Bug
    Affects Versions: 1.5.4
         Environment: linux 2.6.29.2 (bluewhite64)
            Reporter: alex alvarez
            Priority: Minor


The current initialization script under /etc/init.d does not take into consideration when
it's run from that directory using the "./" prefix.

Currently, at least in version 1.5.4, starting on line 70, you have...

case $0 in                                  
    /*)                                     
        SCRIPT="$0"                         
        ;;                                  
    *)                                      
        PWD=`pwd`                           
        SCRIPT="$PWD/$0"                    
        ;;                                  
esac                                        

, which assumes the script is started with its fully qualified name or as a single word, assuming
you have `pwd` on your path.

One possible solution is to have these lines replaced by the following...

case $0 in                                  
    /*)                                     
        SCRIPT="$0"                         
        ;;                                  
   ./*)                                     
        SCRIPT="`pwd`/`echo $0 | sed -e 's/^[ ]*\.\///'`"
        ;;                                               
     *)                                                  
        SCRIPT="`pwd`/`echo $0 | sed -e 's/^[ ]*//'`"                        
        ;;                                               
esac

The PWD variable is not used anywhere else in the script, thus it's not really necessary.
 But more importantly, it now can work with the "./" prefix, and also clears spaces at the
beginning of the line, if any.

The following lines make up the patch file...

74,76c74,78
<     *)
<         PWD=`pwd`
<         SCRIPT="$PWD/$0"
---
>    ./*)
>         SCRIPT="`pwd`/`echo $0 | sed -e 's/^[ ]*\.\///'`"
>       ;;
>      *)
>         SCRIPT="`pwd`/`echo $0 | sed -e 's/^[ ]*//'`"
78a81
> echo $SCRIPT


Cheers, Alex Alvarez


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message