Path: utzoo!attcan!uunet!mcvax!unido!infbs!hafer
From: hafer@infbs (Udo Hafermann)
Newsgroups: comp.sys.atari.st
Subject: The horrible UNLINK bug
Message-ID: <109@infbsgr.infbs>
Date: 1 Dec 88 12:54:50 GMT
Reply-To: hafer@infbsgr.UUCP (Udo Hafermann)
Organization: TU Braunschweig,Informatik,West Germany
Lines: 26

Consider the following situation:

- A process opens and writes to a file;
- the file is deleted (unlinked);
- the process writes to the handle, which remains accessable,
- and then closes the handle.

When deleting a file, TOS updates the directory entry for the file,
freeing its clusters, but does not free any associated handles.  When
the handle is closed, TOS writes the information in the File Control
Block to the (invalid) directory entry. 

This can have desastrous effects:
	A new file reusing the directory entry may be destroyed;
	if the directory entry is still deleted, TOS will write to the
	(non-existent) cluster 0, i.e., garbage is written to the
	root directory!

What was the intended behaviour of TOS?
Bug or feature?

There are, by the way, quite a few programs which don't close the handle
when deleting an associated file, e.g. Mark Williams' micro-shell during
'mv'-operations.

Any comments?  Any comments, ATARI?