Subject: bin/9274: minor tar vtf bug in GNU tar
To: None <gnats-bugs@gnats.netbsd.org>
From: None <giles@nemeton.com.au>
List: netbsd-bugs
Date: 01/22/2000 05:06:55
>Number:         9274
>Category:       bin
>Synopsis:       tar vtf bug in GNU tar
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 22 05:06:00 2000
>Last-Modified:
>Originator:     Giles Lean
>Organization:
>Release:        -current as of January 22nd 2000
>Environment:
	
System: NetBSD nemeton.com.au 1.4_ALPHA NetBSD 1.4_ALPHA (NEMETON-WD0) #0: Tue Aug 24 07:59:39 EST 1999 giles@nemeton.com.au:/usr/src-1.4_ALPHA/sys/arch/i386/compile/NEMETON-WD0 i386


>Description:
	GNU tar 1.11.2 and also 1.13 have a bug listing files in a tar
	archive ("ustar" format) where a directory has a non-zero size.

	Actual extraction of the files is not effected, just listing.

>How-To-Repeat:
        Obtain a ustar format archive which contains a diretcory with
	a non-zero size.  A suitable test file is:

	ftp://cr.yp.to/dnscache/dnscache-0.75.tar.gz

	tar tvf dnscache-0.75.tar
	drwxr-xr-x 0/0           11264 Jan 18 01:53 2000 dnscache-0.75
	-rw-r--r-- 0/0            2243 Jan 18 01:53 2000 dnscache-0.75/TARGETS
	...

	Note that some files are missing from the listing.

	pax -v -f dnscache-0.75.tar
	drwxr-xr-x  2 root     wheel      11264 Jan 18 01:53 dnscache-0.75
	-rw-r--r--  1 root     wheel        177 Jan 18 01:53 dnscache-0.75/README
	-rw-r--r--  1 root     wheel        435 Jan 18 01:53 dnscache-0.75/TODO
	-rw-r--r--  1 root     wheel       3268 Jan 18 01:53 dnscache-0.75/CHANGES
	-rw-r--r--  1 root     wheel         14 Jan 18 01:53 dnscache-0.75/VERSION
	-rw-r--r--  1 root     wheel       2462 Jan 18 01:53 dnscache-0.75/FILES
	-rw-r--r--  1 root     wheel         98 Jan 18 01:53 dnscache-0.75/SYSDEPS
	-rw-r--r--  1 root     wheel       2243 Jan 18 01:53 dnscache-0.75/TARGETS
	...

	This bug is not NetBSD specific.

>Fix:
       1. use pax instead
       2. review and apply the following diff

*** src/list.c-1.13	Wed Jul  7 15:46:30 1999
--- src/list.c	Sat Jan 22 23:32:27 2000
***************
*** 274,280 ****
  
    /* Skip to the next header on the archive.  */
  
!   skip_file (current_stat.st_size);
  
    if (multi_volume_option)
      assign_string (&save_name, NULL);
--- 274,281 ----
  
    /* Skip to the next header on the archive.  */
  
!   if (current_header->header.typeflag != DIRTYPE)
!     skip_file (current_stat.st_size);
  
    if (multi_volume_option)
      assign_string (&save_name, NULL);
>Audit-Trail:
>Unformatted: