Path: utzoo!utgpu!water!watmath!clyde!rutgers!gatech!purdue!umd5!ames!coherent!aimt!uunet!longway!std-unix From: std-unix@longway.TIC.COM (Moderator, John S. Quarterman) Newsgroups: comp.std.unix Subject: Re: Standards Update (3 of 4): NBS FIPS Message-ID: <132@longway.TIC.COM> Date: 17 Feb 88 22:42:48 GMT References: <116@longway.TIC.COM> <120@longway.TIC.COM> <130@longway.TIC.COM> Reply-To: uunet!harvard.harvard.edu!haddock!karl (Karl Heuer) Organization: Interactive Systems, Boston Lines: 44 Approved: jsq@longway.tic.com (Moderator, John S. Quarterman) From: uunet!harvard.harvard.edu!haddock!karl (Karl Heuer) In article <130@longway.TIC.COM> the moderator writes: >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). On at least one SysV-based system with a rename() system call and with unprivileged mv command, the following can occur. $ cat <<\! >rename.c > main(c,v) char **v; { if (rename(v[1], v[2]) == -1) perror("rename"); } > ! $ cc rename.c -o rename $ ls rename rename.c $ mkdir foo $ mkdir foo/bar $ mv foo/bar bar mv: directory rename only $ ./rename foo/bar bar $ ls bar foo rename rename.c $ ls foo $ exit As you can see, even though the system call works properly, `mv' on this system attempts to enforce a restriction that the only thing you can do with a directory is a `simple' rename (one where the `..' entry does not change). My reinterpretation of John Chamber's question has two parts: (a) Does the standard require that the rename() function allow non-simple renames of directories? (b) Does the standard require that the mv command allow this? [1003.1 doesn't say anything about mv, because that's in 1003.2. I don't know offhand what 1003.2 says. 1003.2 people? -mod] Volume-Number: Volume 13, Number 18