AF:
NF:0
PS:10
SRH:1
SFN:
DSR:
MID:<20071108131318.54c548f8@ripper.onstor.net>
CFG:
PT:0
S:andy.sharp@onstor.com
RQ:
SSV:onstor-exch02.onstor.net
NSV:
SSH:
R:<ed.kwan@onstor.com>,<brian.nguyen@onstor.com>
MAID:1
X-Sylpheed-Privacy-System:
X-Sylpheed-Sign:0
SCF:#mh/Mailbox/sent
RMID:#imap/andys@onstor.net@onstor-exch02.onstor.net/INBOX	0	BB375AF679D4A34E9CA8DFA650E2B04E0679466A@onstor-exch02.onstor.net
X-Sylpheed-End-Special-Headers: 1
Date: Thu, 8 Nov 2007 13:42:15 -0800
From: Andrew Sharp <andy.sharp@onstor.com>
To: "Ed Kwan" <ed.kwan@onstor.com>
Cc: "Brian Nguyen" <brian.nguyen@onstor.com>
Subject: Re: EverON-3.1.0.5-install.sh
Message-ID: <20071108134215.50c1ed97@ripper.onstor.net>
In-Reply-To: <BB375AF679D4A34E9CA8DFA650E2B04E0679466A@onstor-exch02.onstor.net>
References: <BB375AF679D4A34E9CA8DFA650E2B04E067942A4@onstor-exch02.onstor.net>
	<20071108081508.456bb7c4@ripper.onstor.net>
	<BB375AF679D4A34E9CA8DFA650E2B04E06794503@onstor-exch02.onstor.net>
	<20071108115916.1c06365e@ripper.onstor.net>
	<BB375AF679D4A34E9CA8DFA650E2B04E0679466A@onstor-exch02.onstor.net>
Organization: Onstor
X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Thu, 8 Nov 2007 13:02:01 -0800 "Ed Kwan" <ed.kwan@onstor.com> wrote:

> Tried that too, and doesn't work.  The variable is changed within the
> scope of the while-loop only, and it remains 0 within the function. 
> 
> Already told CS not to use the script when upgrading from 3.x to 3.x.
> Maybe we should enforce that?  Need to discuss with QA & CS.

Indeed.  The script can be modified to eventually work, but should we.

> > -----Original Message-----
> > From: Andy Sharp
> > Sent: Thursday, November 08, 2007 11:59 AM
> > To: Ed Kwan
> > Cc: Brian Nguyen
> > Subject: Re: EverON-3.1.0.5-install.sh
> > 
> > On Thu, 8 Nov 2007 10:28:20 -0800 "Ed Kwan" <ed.kwan@onstor.com>
> wrote:
> > 
> > > Hi Andy,
> > >
> > > Well, customers are using it to upgrade from 3.x to 3.x.  Whether
> > > it's a bug or ECR or PVR, it's giving Brian and me headaches.
> > 
> > Sorry to hear that it's giving you headaches.  Can't we just
> > pull it except for the release it was intended for?
> > 
> > > Before I sent you the email yesterday evening, I wasted 1/2 hr
> trying
> > > similar code change you suggested, and it didn't work:
> > 
> > Even more sorry to hear that.
> > 
> > Well, what a PoS this shell is then.  How about adding a variable,
> such
> > as
> > 
> > avail=0
> > df | grep | while read dev pavail ; do
> >     if [ "$mpt" = "$fs" ] ; then
> >         avail=$pavail
> >         break
> >     fi
> > done
> > echo $avail
> > 
> > 
> > You can also add the quoting in the other routine, it can only help.
> > 
> > > eng236# cat s1
> > > #!/bin/sh
> > >
> > > get_free_space() {
> > >         set -vx
> > >         fs=$1
> > >
> > >         df -k | grep '^/dev' | while read dev sz used avail crack
> > > mpt ; do
> > >                         echo $dev $avail
> > >                         return
> > >                         echo "after return"
> > >         done
> > >         echo "should not reach"
> > > }
> > >
> > > p="/ /tmp"
> > > a=`get_free_space "$p"`
> > > echo a is $a
> > >
> > > eng236# ./s1
> > > + fs=/ /tmp
> > > + df -k
> > > + grep ^/dev
> > > + read dev sz used avail crack mpt
> > > + echo /dev/wd1a 29692
> > > + return
> > > + echo should not reach
> > > a is /dev/wd1a 29692 should not reach
> > >
> > > The "return" statement causes the while-loop to exit, but we
> continue
> > > execution in get_free_space().
> > >
> > > Ed
> > >
> > >
> > > > -----Original Message-----
> > > > From: Andy Sharp
> > > > Sent: Thursday, November 08, 2007 8:15 AM
> > > > To: Ed Kwan
> > > > Cc: Brian Nguyen
> > > > Subject: Re: EverON-3.1.0.5-install.sh
> > > >
> > > > On Wed, 7 Nov 2007 19:27:52 -0800 "Ed Kwan" <ed.kwan@onstor.com>
> > > wrote:
> > > >
> > > > > Hi Andy,
> > > >
> > > > Hi Eric,
> > > >
> > > > > While researching TED 20993, I noticed a bug in the EverON
> install
> > > > > script.  When a customer use it on a 3.x system,
> /usr/local/agile
> > > and
> > > > > /usr don't exist, so get_free_space() won't echo any numbers.
> > > > > This causes a syntax error in line 497:
> > > >
> > > > First of all, let's get something straight.  It's not a bug in
> > > > the script, as the requirements for the script never included
> > > > this
> use,
> > > > ie., upgrading from a 3.x to something else.  Customers should
> > > > really use upgrade.
> > > >
> > > > Phew, now that we have that major issue straightened out, on to
> the
> > > > next part.
> > > >
> > > > What is bug 20993?
> > > >
> > > > You do have /usr and /usr/local/agile, if you are on a system
> > > > the
> > > script
> > > > was designed to run on, so you need to take a good long look at
> this
> > > > script to see where else there might be parts that expect
> > > > similar circumstances; there may actually be quite a few.
> > > >
> > > > Of course, you could just assign the bug to me^H^HLarry.
> > > >
> > > > Or just change get_free_space thusly:
> > > >
> > > > get_free_space() {
> > > > 	fs=$1
> > > >
> > > > 	df -k | grep '^/dev' | while read dev sz used avail
> > > > crack mpt ;
> > > do
> > > > 		if [ "$mpt" = "$fs" ] ; then
> > > > 			echo $avail
> > > > 			return
> > > > 		fi
> > > > 	done
> > > > 	echo 0
> > > > }
> > > >
> > > > Cheers,
> > > >
> > > > a
> > > >
> > > > >     475 findspace() {
> > > > >
> > > > >     481         # find the biggest chunk of free space
> > > > >     482         for p in / /usr /usr/local/agile /var ; do
> > > > >
> > > > >     496                 a=`get_free_space "$p"`
> > > > >     497                 if [ $a -gt $fkb ] ; then, and
> > > > >
> > > > > Here are my proposed changes.  Please review.
> > > > >
> > > > > Thanks,
> > > > > Ed
> > > > >
> > > > > [edk@edk-linux Tools]$ p4 diff -dc
> > > > > ==== //depot/dev/nfx-tree/Tools/cw_install.in#3 -
> > > > > /homes/edk/p4/dev/nfx-tree/Tools/cw_install.in ====
> > > > > ***************
> > > > > *** 465,470 ****
> > > > > --- 465,471 ----
> > > > >         df -k | grep '^/dev' | while read dev sz used avail
> crack
> > > > > mpt ; do
> > > > >                 if [ "$mpt" = "$fs" ] ; then
> > > > >                         echo $avail
> > > > > +                         break
> > > > >                 fi
> > > > >         done
> > > > >   }
> > > > > ***************
> > > > > *** 494,500 ****
> > > > >                         fi
> > > > >                 fi
> > > > >                 a=`get_free_space "$p"`
> > > > > !               if [ $a -gt $fkb ] ; then
> > > > >                         d=`expr $a - $fkb`
> > > > >                         if [ $d -ge 10240 ] ; then
> > > > >                                 # 10 MB is enough, we're out
> > > > > of here --- 495,501 ----
> > > > >                         fi
> > > > >                 fi
> > > > >                 a=`get_free_space "$p"`
> > > > > !               if [ "$a" -gt $fkb ] ; then
> > > > >                         d=`expr $a - $fkb`
> > > > >                         if [ $d -ge 10240 ] ; then
> > > > >                                 # 10 MB is enough, we're out
> > > > > of here
> > > > >
> > > > >
