wescott@ncrcae.UUCP (12/08/83)
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
salkind@cmcl2.UUCP (Lou Salkind) (12/13/83)
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);