rename strangeness, a possible bug

Jyrki Kuoppala jkp at cs.HUT.FI
Sat Aug 26 21:45:52 AEST 1989


In article <647 at cbnewsi.ATT.COM>, npl at cbnewsi (nickolas.landsberg) writes:
>In article <24612 at santra.UUCP> jkp at cs.HUT.FI (Jyrki Kuoppala) writes:
> > jkp at joker.hut.fi 'src' 451: ls -lagF
> > total 4
> > drwxrwxr-x  4 root     staff         512 Aug 25 01:04 ./
> > drwxr-xr-x  6 nobody   wheel         512 Aug 23 23:33 ../
> > drwxr-xr-x  2 haa      staff         512 Aug 24 16:32 OS-hd-fix/
> > drwxrwxr-x  4 jkp      staff         512 Aug 25 01:04 local/
> > jkp at joker.hut.fi 'src' 452: mv OS-hd-fix local
> > mv: OS-hd-fix: rename: Permission denied
>
>"mv" only allows the rename of a directory "only if the the two
>directories have the same parent."  In this case, the attempted move

Not so on bsd; you can move directories all over the place, just like
files.  On the above example, howeer, it seems that I can't move
OS-hd-fix because I don't have write permission to the directory
OS-HD-fix.  If OS-HD-fix were a directory, I would be able to move it.
That's why I think this is a bug, either in the kernel or in the
documentation (rename(2) doesn't mention the restriction that you
should be able to write to the directory moved).

The reason that many people have already mentioned is probably that
the `..' entry for OS-HD-fix needs to be changed when it's moved.  But
I don't think that's a valid reason; as the kernel hides the . and ..
entries from us by allowing us to say rename(dir1, dir2) IMHO it
should also hide the changing of the `..' entry.

//Jyrki



More information about the Comp.unix.wizards mailing list