🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Arthur David Olson Mon, 22 Sep 1986 20:33
4.[123]BSD tar mishandles truncated tapes (with fix)
#1682
Author: 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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads