View Single Post
  #1 (permalink)  
Old August 17th, 2003
kadmos kadmos is offline
Novicius
 
Join Date: August 17th, 2003
Location: Melbourne, Australia
Posts: 2
kadmos is flying high
Unhappy 3.4.4 installer bugs

I just tried to install LimeWire 3.4.4 on my Red Hat Linux 9.0.93 machine, and noticed a few bugs in the installer shell script.

I tried to register for an account on LimeWire.org to report them, but that also was broken, so I'm posting them here while the issues are fresh in my mind.

1. test logic

Some places in the installer, tests are done to see whether variables are set, such as the test at line 326:
if [ ! \( -z $AVAIL_SPACE -o -z $NEEDED_SPACE \) ]

a) this logic can be greatly simplified
! ( !X OR !Y) = X AND Y
=>
if [ -n $AVAIL_SPACE -a -n $NEEDED_SPACE ]

b) the variables should be enclosed in double quotes in case the variable is empty
=>
if [ -n "$AVAIL_SPACE" -a -n "$NEEDED_SPACE" ]

2. redundant defaults

Some places, variables are given default values, but that section of code would not be evaluated if the value was empty anyway. In this case, there is no need for the default value. For instance, at line 327:
if [ ${AVAIL_SPACE:-0} -lt ${NEEDED_SPACE:-0} ]; then
=>
if [ ${AVAIL_SPACE} -lt ${NEEDED_SPACE} ]; then

3. POSIX behavior of tail command

The installer sets POSIXLY_CORRECT to ensure the expected output of df, yet ignores the other side effects of doing so, for instance, this breaks the way "tail" is used, as POSIX expects "tail -n <lines>", rather than "tail -<lines>". With the version of GNU tail I am using, this is a fatal error.

The easiest and probably most correct way of fixing this is to modify commands like tail to also use POSIX syntax. For instance, at line 379:
AVAIL_SPACE=`$DF_CMD . 2>/dev/null | awk "{print \\\$$DF_AVAIL_COL}" | tail -1 `
=>
AVAIL_SPACE=`$DF_CMD . 2>/dev/null | awk "{print \\\$$DF_AVAIL_COL}" | tail -n 1 `

I hope someone can make the required changes as soon as possible.
Reply With Quote