amverify and grep

2002-01-03 Thread Chris Karakas

Hello,

after upgrading to SuSE 7.3, I found that my amverify script
(amanda-2.4.1p1) did not work properly - it told me that VOLUME is
"matches" and Date is "file":

Volume matches, Date file

(actually, the first time I saw this I really thought the volume matches
a "date file" - this may indeed "mean" something, especially if the
first time you happen to use amverify in the past few months is after
the refreshing experience of an upgrade of 400 packages...;-).

This comes from the write statement

report "Volume $VOLUME, Date $DWRITTEN"

so clearly VOLUME and DWRITTEN were computed wrongly. But how, since I
did not change the script at all?

The answer is that, due probably to the upgrade from SuSE 6.2 to 7.3,
the behaviour of grep has changed. Indeed, for binary files, grep now
says:

Binary file xxx matches

instead of showing the line where the match happens. This may be good in
other occasions, but for amverify it has the effect that when grep is
used in the computation of TAPENDATE:

TAPENDATE=`grep AMANDA: $TEMP/header | sed 's/^AMANDA: TAPESTART //'`

grep will say

Binary file /tmp/header matches

so that when, a few lines further, we do

set X $TAPENDATE
shift
VOLUME=$4
DWRITTEN=$2


VOLUME will be "matches" and DWRITTEN will be "file".

The remedy is to use the -a option to grep in the TAPENDATE line:


---
TAPENDATE=`grep -a AMANDA: $TEMP/header | sed 's/^AMANDA:
TAPESTART //'`
[ X"$TAPENDATE" = X"" ] \
 report "** No amanda tape in slot" \
 continue
set X $TAPENDATE
shift   
VOLUME=$4
DWRITTEN=$2
-

I decided to post this curiosity, since I did not find any similar
message.
Please CC me - I am not on the list anymore.

-- 
Regards
Chris Karakas
Dont waste your cpu time - crack rc5: http://www.distributed.net



Re: amverify and grep

2002-01-03 Thread Jean-Louis Martineau

Hi Chris,

Upgrade, it was fixed a year ago.
You can upgrade only the amverify script if you want.

Jean-Louis

On Fri, Jan 04, 2002 at 02:38:14AM +0100, Chris Karakas wrote:
 Hello,
 
 after upgrading to SuSE 7.3, I found that my amverify script
 (amanda-2.4.1p1) did not work properly - it told me that VOLUME is
 matches and Date is file:
 
 Volume matches, Date file
 
 (actually, the first time I saw this I really thought the volume matches
 a date file - this may indeed mean something, especially if the
 first time you happen to use amverify in the past few months is after
 the refreshing experience of an upgrade of 400 packages...;-).
 
 This comes from the write statement
 
 report Volume $VOLUME, Date $DWRITTEN
 
 so clearly VOLUME and DWRITTEN were computed wrongly. But how, since I
 did not change the script at all?
 
 The answer is that, due probably to the upgrade from SuSE 6.2 to 7.3,
 the behaviour of grep has changed. Indeed, for binary files, grep now
 says:
 
 Binary file xxx matches
 
 instead of showing the line where the match happens. This may be good in
 other occasions, but for amverify it has the effect that when grep is
 used in the computation of TAPENDATE:
 
 TAPENDATE=`grep AMANDA: $TEMP/header | sed 's/^AMANDA: TAPESTART //'`
 
 grep will say
 
 Binary file /tmp/header matches
 
 so that when, a few lines further, we do
 
 set X $TAPENDATE
 shift
 VOLUME=$4
 DWRITTEN=$2
 
 
 VOLUME will be matches and DWRITTEN will be file.
 
 The remedy is to use the -a option to grep in the TAPENDATE line:
 
 
 ---
 TAPENDATE=`grep -a AMANDA: $TEMP/header | sed 's/^AMANDA:
 TAPESTART //'`
 [ X$TAPENDATE = X ] \
  report ** No amanda tape in slot \
  continue
 set X $TAPENDATE
 shift   
 VOLUME=$4
 DWRITTEN=$2
 -
 
 I decided to post this curiosity, since I did not find any similar
 message.
 Please CC me - I am not on the list anymore.
 
 -- 
 Regards
 Chris Karakas
 DonĀ“t waste your cpu time - crack rc5: http://www.distributed.net

-- 
Jean-Louis Martineau email: [EMAIL PROTECTED] 
Departement IRO, Universite de Montreal
C.P. 6128, Succ. CENTRE-VILLETel: (514) 343-6111 ext. 3529
Montreal, Canada, H3C 3J7Fax: (514) 343-5834