5.1.b PK4 installation bug/question

From: Örjan Petersson <orjan.petersson_at_logcode.com>
Date: Sat, 19 Nov 2005 12:38:03 +0100

Hi,
I have found a small bug in the /usr/sbin/dupatch delivered as part of 5.1.b PK4.
The version is
# _at_(#)$RCSfile: dupatch.sh,v $ $Revision: 1.1.2.56 $ (DEC) $Date: 2004/06/07 14:40:21 $

and the problem is the following function:

FitsetSetup()
{
        PWD=`pwd`

        DEF_USRRSV=40960
        DEF_ROOTRSV=15360

        DUK=
        HOSTNAME=`/usr/sbin/rcmgr get HOSTNAME`
        [ "$HOSTNAME" ] &&
        {
                HOSTNAME=`Parse . $HOSTNAME | awk '{print $1}'`
                HOSTNAME=`Ucase $HOSTNAME`
                [ -d /usr/sys/$HOSTNAME ] &&
                {
                        cd /usr/sys/$HOSTNAME
                        DUK=`du -sk . | awk '{print $1}'`
                }
        }
        DUK=`expr $DUK \* 2`
        USRRSV=`FitsetReserve $DEF_USRRSV $DUK`

        DUK=
        [ -f /vmunix ] &&
        {
                cd /
                DUK=`du -sk vmunix | awk '{print $1}'`
        }
        ROOTRSV=`FitsetReserve $DEF_ROOTRSV $DUK`

        cd $PWD

}

Here DUK is first set to "" and it is only if /usr/sys/$HOSTNAME exists that it get
changed to something else. The hostname on the machine I am patching has been changed
and I do not have /usr/sys/$HOSTNAME, only /usr/sys/$THE_OLD_HOSTNAME, so the result
is that the statement
DUK=`expr $DUK \* 2`
fails with a syntax error.

I can fix this problem in various ways, e.g. rename /usr/sys/$THE_OLD_HOSTNAME to
/usr/sys/$HOSTNAME or simply set DUK to something sensible in the script, but I
would like to know if there is any "correct" way of doing this (or if there are
any gotchas).

-- 
Best regards, 
Örjan Petersson, Logcode SARL, currently with Ericsson Algeria 
24, rue de la Charličre, FR-42270 St-Priest-en-Jarez, France
Phone: +33-4.77.79.65.14, Mobile: +33-6.62.25.37.94
In Algeria: +213-61.699.745, In Sweden: +46-705 135 998
Received on Sat Nov 19 2005 - 11:40:49 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:45 NZDT