ado@elsie.UUCP (Arthur David Olson) (09/22/86)
Index: bin/tar Fix
Description:
The 4.[123]BSD tar command can go into an infinite loop if
presented with a truncated "tape".
Repeat-By:
Type in the commands
tar cf foo /usr/pub/greek /usr/pub/ascii
dd if=foo of=bar bs=512 count=6
tar tf bar
and note (until you get tired of noting) the output:
Tar: blocksize = 6
/usr/pub/greek
/usr/pub/ascii
/usr/pub/ascii
/usr/pub/ascii
...
Fix:
Here's the change to the 4.1BSD version of "tar.c".
...
readtape(buffer)
char *buffer;
{
register int i;
if (recno >= nblock || first == 0) {
#ifdef OLDVERSION
if ((i = read(mt, tbuf, TBLOCK*nblock)) < 0) {
#else
if ((i = read(mt, tbuf, TBLOCK*nblock)) <= 0) {
#endif
fprintf(stderr, "Tar: tape read error\n");
done(3);
}
...
--
Bug/s is a Volkswagen/Warner Brothers trademark.
I'll avoid mentioning trademarks, tar, and tobacco.
--
UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA
DEC, VAX, Elsie & Ado are Digital, Borden & Ampex trademarks.