home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.13 / text0016.txt < prev    next >
Encoding:
Internet Message Format  |  1988-04-18  |  1.3 KB

  1. From: uunet!harvard.harvard.edu!haddock!karl (Karl Heuer)
  2.  
  3. In article <130@longway.TIC.COM> the moderator writes:
  4. >I don't really understand the question, but if it's whether the rename
  5. >function can be used to move directories, the answer is yes (although the
  6. >user command is mv).
  7.  
  8. On at least one SysV-based system with a rename() system call and with
  9. unprivileged mv command, the following can occur.
  10.  
  11. $ cat <<\! >rename.c
  12. > main(c,v) char **v; { if (rename(v[1], v[2]) == -1) perror("rename"); }
  13. > !
  14. $ cc rename.c -o rename
  15. $ ls
  16. rename
  17. rename.c
  18. $ mkdir foo
  19. $ mkdir foo/bar
  20. $ mv foo/bar bar
  21. mv: directory rename only
  22. $ ./rename foo/bar bar
  23. $ ls
  24. bar
  25. foo
  26. rename
  27. rename.c
  28. $ ls foo
  29. $ exit
  30.  
  31. As you can see, even though the system call works properly, `mv' on this
  32. system attempts to enforce a restriction that the only thing you can do with a
  33. directory is a `simple' rename (one where the `..' entry does not change).  My
  34. reinterpretation of John Chamber's question has two parts:
  35.  
  36. (a) Does the standard require that the rename() function allow non-simple
  37. renames of directories?
  38.  
  39. (b) Does the standard require that the mv command allow this?
  40.  
  41. [1003.1 doesn't say anything about mv, because that's in 1003.2.
  42. I don't know offhand what 1003.2 says.  1003.2 people?  -mod]
  43.  
  44. Volume-Number: Volume 13, Number 18
  45.  
  46.