Subject: Re: Request For Comments!! POSIX atomic mv
To: None <netbsd-users@netbsd.org>
From: George Georgalis <george@galis.org>
List: netbsd-users
Date: 12/13/2007 00:18:42
On Wed, Dec 12, 2007 at 06:51:23PM -0800, Jan Schaumann wrote:
>George Georgalis <george@galis.org> wrote:
> 
>> How is the netbsd behavior explained that I can
>> rename the mode 555 dir in my home, but not if I'm
>> moving it to my mode 755 tmp at the same time?
>
>setup-XXX is a directory, so it contains an entry called '..'.  When
>you're trying to move setup-XXX to tmp/final2, setup-XXX/.. will change.
>Or rather, would change, if you had permission to do so.  Since the mode
>is 555, you can't change the dir, so can't change '..', so the mv will
>fail.

That's interesting, I had not thought about those special files.

So ./. is what is IN the directory. The name of the directory is
an entry of ./.. when ./. is moved it doesn't change, only ./..
changes.

 geo@run:/home/geo/tmp install -m 555 -d txx      
 geo@run:/home/geo/tmp ls -lTd . txx txx/. txx/.. 
drwxr-xr-x  13 geo  geo  2048 Dec 12 23:59:03 2007 .
dr-xr-xr-x   2 geo  geo   512 Dec 12 23:59:00 2007 txx
dr-xr-xr-x   2 geo  geo   512 Dec 12 23:59:00 2007 txx/.
drwxr-xr-x  13 geo  geo  2048 Dec 12 23:59:03 2007 txx/..
 geo@run:/home/geo/tmp mv txx tyy
 geo@run:/home/geo/tmp ls -lTd . tyy tyy/. tyy/..
drwxr-xr-x  13 geo  geo  2048 Dec 12 23:59:37 2007 .
dr-xr-xr-x   2 geo  geo   512 Dec 12 23:59:00 2007 tyy
dr-xr-xr-x   2 geo  geo   512 Dec 12 23:59:00 2007 tyy/.
drwxr-xr-x  13 geo  geo  2048 Dec 12 23:59:37 2007 tyy/..

Sounds good, is it POSIX?

// George


-- 
George Georgalis, information system scientist <IXOYE><