[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] Difference between -z option and piping to gzip
From: |
Sergey Poznyakoff |
Subject: |
Re: [Bug-tar] Difference between -z option and piping to gzip |
Date: |
Sat, 03 Jan 2004 01:12:05 +0200 |
Hello Jim,
> We understand that the -z option is storing some information (we percieve
> that it is the time of last access) that is not stored by piping to
> gzip.
No, running tar -z is equivalent to piping its stdout to gzip *without
any extra options*. It is gzip that by default adds file name and
the timestamp to the output file. Notice, that in your testcase you
give -n option to gzip:
> address@hidden temp]$ tar -cvf - testfile | gzip -n >test1.tgz
This is why both archives are identical.
To solve the problem you have to pass the same option to the
gzip instance invoked by tar. You can do so by declaring GZIP
environment variable:
export GZIP=-n
tar cfz arch1 testfile &&
sleep 90 &&
tar cfz arch2 testfile &&
diff arch1 arch2; echo $?
Try this and you'll get two identical archives.
Regards,
Sergey