🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.4bsd
Article #1682

4.[123]BSD tar mishandles truncated tapes (with fix)

#1682
From: Arthur David Olson
Date: Mon, 22 Sep 1986 20:33
47 lines
1513 bytes
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.
Technical Details
Message-ID: <6850@elsie.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!elsie!ado

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!elsie!ado
From: ado@elsie.UUCP (Arthur David Olson)
Newsgroups: net.bugs.4bsd
Subject: 4.[123]BSD tar mishandles truncated tapes (with fix)
Message-ID: <6850@elsie.UUCP>
Date: Mon, 22-Sep-86 16:33:47 EDT
Article-I.D.: elsie.6850
Posted: Mon Sep 22 16:33:47 1986
Date-Received: Mon, 22-Sep-86 22:37:05 EDT
Organization: NIH-LEC, Bethesda, MD
Lines: 47
Keywords: BSD tar