Subject: pkg/34536: TME sometimes truncates files when reading via emulated tape drive
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <sigmfsk@aol.com>
List: pkgsrc-bugs
Date: 09/15/2006 19:10:00
>Number:         34536
>Category:       pkg
>Synopsis:       TME sometimes truncates files when reading via emulated tape drive
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 15 19:10:00 +0000 2006
>Originator:     Arthur Townsend
>Release:        3.0
>Organization:
>Environment:
3.0 for i386
>Description:
When reading files into the emulator via the emulated tape drive (issuing: command tape0 load foo.tar at the tmesh prompt, then tar xvf /dev/nrst0 inside the emulator), the last section of data in the tar file is sometimes/usually truncated.
>How-To-Repeat:
Create some files, put them in a tar file.  Read in the tar file, then do a "sum" on the original files, and the files loaded into the emulator environment.  Sometimes the last file will be missing, sometimes the last file will have a different checksum.  I was able to duplicate the problem with the following operating systems inside TME: NetBSD 1.5.3, 1.6.2, 3.0, and SunOS 4.1.1 and SunOS 4.1.1U1.  Some versions seemed to truncate the files more often that others, but all had problems.
>Fix:
Workaround:  Always stick a junk file at the end of a tar set so when it is truncated, it doesn't matter.  Do a checksum on all extracted files to ensure they are correct.  Easiest way is to get all the files to go inside the emulator and put them in a tar file.  Then tar up all the tar files.  ex:  to load one.txt and two.txt:  tar cvf a.tar one.txt two.txt;  cp a.tar junk.tar;  tar cvf b.tar a.tar junk.tar;  command tape0 load b.tar; tar xvf /dev/nrst0 - then a.tar and junk.tar will show up in the emulator.  in the host environment and target emulator environment, sum a.tar junk.tar.  the sum for a.tar will match and junk.tar won't.  delete junk.tar inside the emulator, then tar xvf a.tar inside the emulator and the resulting files will be correct.