home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.21 / text0083.txt < prev    next >
Encoding:
Internet Message Format  |  1990-10-26  |  1.4 KB

  1. From:  caywood@teb.larc.nasa.gov (John Caywood)
  2.  
  3. In Volume 21, Number 42, djm@eng.umd.edu (David J. MacKenzie) writes:
  4. > In draft 10, cp never ever unlinks files.
  5. > In draft 10, all -f does in cp is turn off a previous -i.
  6. > I'm going to object to this on the FSF ballot; I think -f should make
  7. > it unlink (unconditionally), like it does for mv, ln, and rm, or else
  8. > not be specified at all in the standard, since it's not existing
  9. > practice.
  10.  
  11. Based on this article, I was about ready to submit an objection in
  12. support of the above.  On closer inspection, however, I think the
  13. objection is nullified by an earlier clause:
  14.    (3) If source_file exists....
  15.        (a) If dest_file exists....
  16.        [1] If -i is in effect....
  17.        [2] If dest_file isn't writable....
  18.        [3] A file descriptor shall be obtained by performing
  19.            actions equivalent to the POSIX.1 open() function
  20.            call using dest_file as the path argument, and the
  21.            bitwise inclusive OR of O_WRONLY and O_TRUNC as
  22.            the oflag argument.
  23.  
  24. I take this to mean that, no, cp doesn't unlink an existing file, but
  25. it truncates it upon opening under these conditions.  Consequently,
  26. yes, djm is correct, cp doesn't unlink.  I don't understand, though,
  27. why opening with O_TRUNC isn't equivalent.
  28.  
  29.    John Caywood, balloting .2 on behalf of NASA Langley Research Center
  30.  
  31. Volume-Number: Volume 21, Number 84
  32.  
  33.