Path: utzoo!mnetor!uunet!longway!std-unix From: jc@minya.UUCP (John Chambers) Newsgroups: comp.std.unix Subject: Re: Standards Update (3 of 4): NBS FIPS Message-ID: <130@longway.TIC.COM> Date: 15 Feb 88 20:44:05 GMT References: <116@longway.TIC.COM> <120@longway.TIC.COM> Sender: std-unix@longway.TIC.COM Reply-To: jc@minya.UUCP (John Chambers) Organization: home Lines: 38 Summary: Is rename() guaranteed to work across directories? Approved: jsq@longway.tic.com (Moderator, John S. Quarterman) From: jc@minya.UUCP (John Chambers) [ This one got misplaced as I prepared to go to USENIX. I don't really understand the question, but if it's whether the rename function can be used to move directories, the answer is yes (although the user command is mv). -mod ] > >No portable application needs "appropriate privileges" to move directories > >around; it can use "rename()". The correct way to move anything under a POSIX > >implementation is to use "rename()", not "link()" and "unlink()". > > The rename() call is sufficient for changing the name of a directory, ... One thing I've wondered is whether the standard will require implementors to make things like rename("foo/bar/x","foo/x") work correctly. This is a serious omission in a great many Unix releases. It's not at all a hypothetical issue. I've seen a lot of cases where a user (myself included) uses tar or cpio or some such to unpack a bunch of files, intending them to go into foo/bar, and ending up with them all in foo/bar/bar. The usual result is "rm -rf foo/bar/bar" and starting over. It'd save a lot of grief if one could just say something like: rename foo/bar/bar foo/temp rename foo/temp foo/bar and be done with it. Of course, it'd be better if I could just type: rename foo/bar/bar foo/bar and get the desired result, but that's probably too much to hope for. ;-) Given the history of Unix releases, I wouldn't expect this to work when foo/bar/bar is a directory, unless there is some argument stronger than users' needs to convince the implementors. -- John Chambers <{adelie,ima,maynard,mit-eddie}!minya!{jc,root}> (617/484-6393) Volume-Number: Volume 13, Number 16