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

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

From: =?iso-8859-1?b?U+liYXN0aWVu?= Aperghis-Tramoni
Subject: Re: Delete a file THAT big? Surely you are joking.
Date: 17:07 on 18 Dec 2006
Yossi Kreinin wrote:

> >>I removed it using rm. I don't know what you mean.
> >
> > That on Unix, a file is not actually remooved as long as there is an opened
> > filehandle poiinting to it. So if you remove a log while the program
> writing
> > it is still running, you can't free space. You must restart the program so
> > the pending filehandle is closed and the file removed (and the space
> freed).
> > Another solution is to truncate the file (see trunc(3)):
> >
> >     $ >file
>
> This is very sweet of Unix.
>
> * Why is it sensible to allow to truncate a file someone has opened?
> * Especially if you don't allow to remove such files?
> * Or, more specifically, you ALLOW to remove such files, but not to
> reclaim the disk space?

Unix always had the tradition to give you enough rope so you can
hang yourself. OTOH, allowing such seemingly dangerous features
permit powerful tricks and simpler programming.

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

This is called an upgrade. The process won't crash because the code
is already loaded in memory. Upgrades are harder to handle on Win32
precisely because it doesn't allow (by default) to replace opened
files.

--
Sébastien Aperghis-Tramoni

Close the world, txEn eht nepO.
There's stuff above here

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