tar bzip2 auto-detect patch

Matthias Benkmann haferfrost at web.de
Thu Jul 19 11:51:09 PDT 2001

Has it ever happened to you that you typed "tar xzf" out of reflex just to 
notice seconds later that the file is a bz2 file?
Happens to me all the time. Irrational as it may be, that is (or was) the 
major reason why I preferred tar.gz over tar.bz2.
Anyway, it's over now. I just patched tar to use bzip2 if the z option is 
used and the extension of the file provided is .bz2.
Just apply the attached patch instead of the normal gnutarpatch.txt used 
by LFS. My patch incorporates the normal LFS patch so you won't notice any 
difference (unless you happen to come across a gzip file with .bz2 
Note that the patch just tests the extension which means that it only 
works if you use "f" or "--file" to read from a file and only if the file 
has the .bz2 extension. If you read from tape or stdin or the file has any 
extension other than .bz2, the patch does not take effect and tar will 
just behave as usual (i.e. choose gzip if you provide the "z" option.
Note also that auto-detection only affects the "z" option, not the "y" 


In allen Kulturen haben Muetter ihre Babys mit Vorgekautem
von Mund zu Mund gefuettert.
Bis vor kurzem sogar noch in Schleswig-Holstein.

Irenaeus Eibl-Eibesfeldt im SZ Magazin, No.28

Unsubscribe: send email to lfs-discuss-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message

More information about the lfs-dev mailing list