Yossi Kreinin <[email protected]> wrote:
This is very sweet of Unix.

* Why is it sensible to allow to truncate a file someone has opened?

It's entirely reasonable two processes should be able to write to a file.

* Especially if you don't allow to remove such files?

Oh, you can remove them alright.

* Or, more specifically, you ALLOW to remove such files, but not to reclaim the disk space?

Obviously the disk space can't be reclaimed, because a process has a file open still. Therefore it could reasonably expect to be able to read from it, and the data has to come from somewhere. Or should the OS just make it up?

* And how am I supposed to know which process is using the file?

We've covered that already. I'm sure you've read the man page by now.

For instance, Unix will let you overwrite a shared object used by a process, and the process will crash. Isn't it *hateful*?

Yes, it's hateful when that happens and a process crashes, but then you shouldn't open the same file and make changes to it. It's hateful when you hit your thumb with a hammer, but what can I say? You should delete the file and then create a new shared object in its place. Then you'll see why the way unix does this is right, and the way certain other OS's do this is wrong. If that shared object being in use prevented you from opening it, removing it, or replacing it that really would be hateful. Having used windows I speak from experience on that one.

As it is I can upgrade my linux machine to a completely new version of the OS while still happily using it. When the upgrade is complete I reboot at my convenience to be sure it is all running sweetly. None of this booting off a cd and having an hours downtime crap. There's 100s of other perfectly good uses of this feature.

Now what is hateful about this whole situation is that unix has fifteen different ways of locking a file to prevent multiple processes
from using it when this is important. Alas, they generally don't work
with each other and most don't work over nfs. This is a truely shocking state of affairs, but is way too easy to hate so I'll just groan instead. Sigh.

Cheers,

Martin.

Reply via email to