[comp.sys.tandy] Serious bug in TAR -- URGENT

michael@stb.UUCP (Michael) (07/31/88)

I discovered a very nasty bug in tar, the hard way.

Given a file called "empire" which is a tar file whose first entry is for
a directory named "empire", tar will call mkdir to make "empire".
Mkdir will complain, accurately. Tar will then do a creat() call on
empire. 

*** tar does a creat() call on the directory when mkdir failed.
*** It shouldn't do anything.

If it had tried to unlink it and try again, it would have unpack the
archive from the now-dummy file, and no data would have been lost. If
it had done nothing, the file would have been there and no data would
have been lost. Instead, I wound up with a zero length file that should
have been a meg and a half, or a directory.

			Michael
: --- 
: Michael Gersten			 uunet.uu.net!denwa!stb!michael
:				sdcsvax!crash!gryphon!denwa!stb!michael
: What would have happened if we had lost World War 2. Well, the west coast
: would be owned by Japan, we would all be driving foreign cars, hmm...