🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by wescott Wed, 07 Dec 1983 21:47
Tar bug, runs out of files
#152
Author: wescott
Date: Wed, 07 Dec 1983 21:47
39 lines
1302 bytes

Forgive me if this one has been reported before (I'd be
surprised if it hadn't).  Tar stops processing files
after coming across a number of non S_IFREG files.
It doesn't close the open file after opening and fstat'ing
it.  Hence tar can run out of file descriptors.

The bug has been seen in every version we've looked at
(v7, III, 4.1, 5.0) If this is supposed to be a feature
let me know.

In the meantime our fix is to add a close in putfile():

	putfile(longname, shortname)
	char *longname;
	char *shortname;
	{
		.
		.
		.
		infile = open(shortname, 0);
		.
		.
		.
		if ((stbuf.st_mode & S_IFMT) != S_IFREG) {
			fprintf(stderr, "tar: %s is not a file. Not dumped\n", longname);
			close(infile); /**********bug fix************/
			return;
		}
		.
		.
		.
	}

===========================
Michael Wescott
NCR Corp., West Columbia, SC 29169
...duke!mcnc!ncsu!ncrcae!wescott
Re: Tar bug, runs out of files
#155
Author: Lou Salkind
Date: Mon, 12 Dec 1983 21:54
22 lines
1172 bytes
The 4.2 bsd version of tar has a similar (yet different) bug.  Here is
the fix:

*** /usr/src/bin/tar.c.dist	Sun Sep 25 21:05:06 1983
--- /usr/src/bin/tar.c	Mon Dec 12 16:46:52 1983
***************
*** 532,537
  		if (strlen(longname) >= NAMSIZ) {
  			fprintf(stderr, "tar: %s: file name too long\n",
  			    longname);
  			return;
  		}
  		strcpy(dblock.dbuf.name, longname);

--- 532,538 -----
  		if (strlen(longname) >= NAMSIZ) {
  			fprintf(stderr, "tar: %s: file name too long\n",
  			    longname);
+ 			close(infile);
  			return;
  		}
  		strcpy(dblock.dbuf.name, longname);
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