Re: Delete a file THAT big? Surely you are joking.

[prev] [thread] [next] [lurker] [Date index for 2006/12/18]

From: peter (Peter da Silva)
Subject: Re: Delete a file THAT big? Surely you are joking.
Date: 17:19 on 18 Dec 2006
> * Why is it sensible to allow to truncate a file someone has opened?

Because it's not locked.

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

UNIX doesn't have a "remove file" system call. It has a "remove link" system
call.

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

Because the space is reclaimed when the last link to the file is removed
and the last process holding the file open closes it.

Operating systems and file systems that don't implement these semantics (YES,
NFS, I'M TALKING ABOUT YOU) are hateful.

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

You're not supposed to know. That would be a violation of least privilege. In
a sane network file system (ie, not NFS) the process may not even be on the
same computer.

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

     26 ETXTBSY Text file busy.  The new process was a pure procedure (shared
             text) file which was open for writing by another process, or
             while the pure procedure file was being executed an open(2) call
             requested write access.

What's hateful is that some versions of UNIX return ETXTBSY on unlink(), and
others allow root to bypass ETXTBSY. And of course NFS doesn't let the OS
know it's got programs on other computers paging from a local text file. But
that's because NFS is a reeking bucket of putrid toxic malignant hate.

There's stuff above here

Generated at 03:01 on 20 Dec 2006 by mariachi 0.52