Topic
  • 1 reply
  • Latest Post - ‏2008-05-27T19:52:03Z by SystemAdmin
SystemAdmin
SystemAdmin
5837 Posts

Pinned topic DB2 installation script bug report

‏2008-05-27T19:43:26Z |
Hi,

I could not figure out where to post this bug report, so I will post it here:

I have installed DB2 express and found a serious error in the install script. An error which can mess up an existing system, as the install scrips overwrites existing files in /usr/include .

I am running on a Debian system, but the error will appear on any Linux box.

I installed this package ftp://ftp.software.ibm.com/software/data/db2/express/latest_debs/debs_i386/db2exc_9.5.0-1_i386.deb
In the file /opt/ibm/db2exc/V9.5/instance/db2idefs there is a function to make symbolic links. The documentation states that it do not overwrite existing files. This is not true. Here is the "mklink" function:


#-----------------------------------------------------------------------
<ol> <li>Name - mklink</li> <li>Function - Create the given link if not exists</li> <li>Parameters - $1 is the given link to be created, and</li> <li>$2 is the location the link points to.</li> <li>Returns - 0</li> </ol> #-----------------------------------------------------------------------
mklink()
{ set $ {setopts? }
tmplink=$1

if ; then
rm -f $ {tmplink? } ln -s $2 $ {tmplink? } else foundit=`ls -l $ {tmplink? } | grep $2`
if ; then
display_msg $ {DB2CAT? } 87 \
'DBI1087E An attempt to create the link %s failed.' \
"${tmplink?}" fi
fi
}


The important line is:




if ; then

Man page for sh states:

<snip>
-h file True if file exists and is a symbolic link.
</snip>

so it seems this is not the correct flag to use, as files will be overwritten if they are not symbolic links. You should properly use -e instead. From sh's man page:

<snip>
-e file True if file exists.
</snip>

The mklink function is called from /opt/ibm/db2exc/V9.5/instance/db2iutil:


#---------------------------------------------------------------------
<ol> <li>For each file ".h" and ".f" file in the DB2DIR/include</li> <li>directory create the link /usr/include/file. If /usr/include/file</li> <li>already exists then the link is not created and a warning is issued.</li> </ol> #---------------------------------------------------------------------
if ; then
cd $ {DB2DIR? }/include$ {bit? } find *. hf -prune -type f -print 2>/dev/ null | \
while read file; do mklink /usr/include/$ {file } $ {DB2DIR? }/include {bit? }/$ {file? } done
fi

The bug also means that if I remove DB2 Express from my system, the deleted files will not be restored.
Greetings,

Mads Lindstrøm
Updated on 2008-05-27T19:52:03Z at 2008-05-27T19:52:03Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    5837 Posts

    Re: DB2 installation script bug report

    ‏2008-05-27T19:52:03Z  
    The forum system somehow inserted various tags in my message. I do not know why. It looked fine when I did press on "Preview". I have attached a text message which may be more readable to this reply. Hopefully it will be left as is.