bsdtar vs gnutar

Vladimir Grebenschikov vova at fbsd.ru
Wed Sep 8 00:32:30 PDT 2004


В вт, 07/09/2004 в 22:35 -0700, Tim Kientzle пишет:
> Vladimir Grebenschikov wrote:
> > 
> > GNU tar has ability to show detailed info on extract in case when more
> > then one 'v' letter specified like:
> > 
> > $ gtar -xvvzf arch.tar.gz
> > -rwxrwxr-x ivan/ivan       268 Sep  6 16:40 2004 install
> > $ tar -xvvzf arch.tar.gz
> > x install
> 
> I'll look into this.  Probably won't make it into 5.3, though.

Ok, another issue, bsdtar shows archive type at the end of listing when
-tvv specified, but gnu tar not shown:

% tar tvvzf download/hcidump-1.5.tar.gz |& tail -n3
-rw-r--r--  0 max    max      8207 Aug 17  2003 hcidump/parser/sdp.h
-rw-r--r--  0 max    max      3398 Feb 18  2004 hcidump/parser/hidp.c
Archive Format: GNU tar format,  Compression: gzip
% gtar tvvzf download/hcidump-1.5.tar.gz | & tail -n3
-rw-r--r-- max/max       16065 Sep 13 03:38 2003 hcidump/parser/sdp.c
-rw-r--r-- max/max        8207 Aug 17 02:05 2003 hcidump/parser/sdp.h
-rw-r--r-- max/max        3398 Feb 18 01:33 2004 hcidump/parser/hidp.c
%

(Yes, know it is enough -tv to get such list, but I am always use -vv to
get similar result in -t and -x cases)

Archive information is not ls-like output at all:
man tar
...
-v    Produce verbose output.  In create and extract modes, tar will
      list each file name as it is read from or written to the archive.
      In list mode, tar will produce output similar to that of ls(1).
      Additional -v options will provide additional detail.
...

May be move such, mostly debug, info to third -v to be compatible with
gtar ?

> > Another problem, gnu tar output -v output while extracting on stdout,
> > but BSD tar output this on stderr ("tar -xvzf arch.tar.gz | head -n1" no
> > longer work)
> 
> Not always.  ;-)  Sometimes gnutar outputs to stderr,
> sometimes to stdout.  POSIX.1-1997 clearly specifies
> stderr.  (Yet another place where gtar ignores the POSIX
> standards... ;-/
> 
> I suggest you try
>      tar -xvzf arch.tar.gz |& head -n1
> or
>      tar -xvzf arch.tar.gz 2>&1 | head -n1
> 
> which will work correctly with either gtar or
> bsdtar.

Ok, I vote for POSIX compliance.

> Cheers,
> 
> Tim Kientzle

-- 
Vladimir B. Grebenchikov
vova at fbsd.ru


More information about the freebsd-current mailing list