[gnu.utils.bug] bug in tar-1.07 on AT&T UNIXpc

brant@manta.pha.pa.us (Brant Cheikes) (06/15/89)

The machine: AT&T UNIXpc (MC68010 CPU), aka PC7300 or 3b1.
The OS: USG UNIX SV, UNIXpc version 3.51.
tar 1.07, FTP'd from prep.ai.mit.edu.

Multi-volume tar using UNIXpc floppies does not work.  In particular,
files are not properly split across volume boundaries, causing the
message "This volume is out of sequence" to incorrectly appear.

I have tracked down what I believe to be the source of the problem,
but I'm having trouble figuring out what all the relevant code is
doing, so I as yet do not have a fix.  I'll describe the problem in
hopes that perhaps someone else can offer a fix and thus save me some
Tylenol.

The bug is in fl_write() in buffer.c.  When the UNIXpc runs out of
space on /dev/rfp021 (the floppy drive), write() will (correctly)
return the count of bytes written up to the end of volume, which will
be less than the blocksize.  Note, however, that errno will be set to
zero, i.e., end of volume is not treated as an error.  Thus the first
part of the bug fix requires changing this line (in fl_write()):

	if(err>0 || (errno!=ENOSPC && errno!=EIO && errno!=ENXIO))

to the conditionalized version:

#ifdef unixpc
	if(err>0 && errno && errno!=ENOSPC && errno!=EIO && errno!=ENXIO)
#else
	if(err>0 || (errno!=ENOSPC && errno!=EIO && errno!=ENXIO))
#endif

Now at this point, err contains the number of bytes successfully
written from the buffer to the floppy.  The new volume needs to be
initialized with the proper headers and so forth, and then the
interrupted buffer flush MUST BE CONTINUED from position err in the
buffer.  Err must also be taken into account in the computations of
sizeleft.  Since I haven't quite grokked the code yet, I don't know
how to proceed.  Ideas, anyone?

On a different, albeit related topic: I find it irritating that a
volume name must always be specified in order for multivolume
processing to work correctly.  There should be a default volume name
that can be superseded by the argument to the -V option.
-- 
Brant Cheikes
University of Pennsylvania, Department of Computer and Information Science
brant@manta.pha.pa.us, brant@linc.cis.upenn.edu, bpa!manta!brant