Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!uunet!mcsun!sunic!tut!santra!jkp From: jkp@cs.HUT.FI (Jyrki Kuoppala) Newsgroups: comp.unix.wizards Subject: Re: rename strangeness, a possible bug Message-ID: <24688@santra.UUCP> Date: 26 Aug 89 11:45:52 GMT References: <24612@santra.UUCP> <8352@boring.cwi.nl> <647@cbnewsi.ATT.COM> Sender: news@santra.UUCP Reply-To: jkp@cs.HUT.FI (Jyrki Kuoppala) Organization: Helsinki University of Technology, Finland Lines: 29 In-reply-to: npl@cbnewsi.ATT.COM (nickolas.landsberg) In article <647@cbnewsi.ATT.COM>, npl@cbnewsi (nickolas.landsberg) writes: >In article <24612@santra.UUCP> jkp@cs.HUT.FI (Jyrki Kuoppala) writes: > > jkp@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@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