Subject: bin/9647: pax(1) can't read multi-volume archive from device
To: None <gnats-bugs@gnats.netbsd.org>
From: None <itohy@netbsd.org>
List: netbsd-bugs
Date: 03/20/2000 21:04:51
>Number:         9647
>Category:       bin
>Synopsis:       pax(1) can't read multi-volume archive from device
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 20 19:18:00 2000
>Last-Modified:
>Originator:     ITOH Yasufumi
>Organization:
	
>Release:        1.4T (Feb. 23, 2000)
>Environment:
System: NetBSD pino.my.domain 1.4T NetBSD 1.4T (PINO) #197: Tue Feb 22 16:53:26 JST 2000 itohy@pino.my.domain:/usr/src/sys/arch/i386/compile/PINO i386


>Description:
	pax(1) fails to read multi-volume archive from device unless
	the size of media is a muliple of certain value (?? I'm not sure).

	I chose the category "bin" for this pr, but this might be
	a kernel issue.

>How-To-Repeat:
	Try the following instruction.  You need two ttys.

  [ terminal 1 ]			  [ terminal 2 ]
cd /usr/src/bin/pax			cd /var/tmp
raw=`sysctl -n kern.rawpartition | \	dd if=/dev/zero of=img1 bs=100k count=1
	tr 0-7 a-h`			dd if=/dev/zero of=img2 bs=100k count=1
					vnconfig -c vnd0 img1 512/10/2/10
pax -w -v -f /dev/rvnd0$raw [abp]*
  # next archive prompted
					vnconfig -u vnd0
					vnconfig -c vnd0 img2 512/10/2/10
  # type 'y' and return
					vnconfig -u vnd0
cat /var/tmp/img[12] | tar df -
  # no error (archive is OK)

mkdir tmp && cd tmp
					vnconfig -c vnd0 img1 512/10/2/10
pax -r -v -f /dev/rvnd0$raw
  # next archive prompted
					vnconfig -u vnd0
					vnconfig -c vnd0 img2 512/10/2/10
  # type 'y' and return
					vnconfig -u vnd0
diff . ..
  # shows difference
  # THIS IS WRONG

cd ..					rm img[12]
rm -r tmp


>Fix:
	The cause of this problem is that pax(1) can't see the
	end of media (EOM) of disk device.
	read(2) returns with EIO if the request exceeds the EOM,
	and pax(1) fails to read just before the EOM of the device.

	Possible fix would be:

	 1. fix pax(1) to be able to find the EOM of disk using
	    some special methods, or,

	 2. fix the kernel and make read(2) and write(2) return
	    with partial success at the EOM (just like as regular file).

>Audit-Trail:
>Unformatted: