home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / std_unix / v21 / 084 < prev    next >
Internet Message Format  |  1990-12-05  |  2KB

  1. From std-unix-request@uunet.uu.net  Thu Sep  6 18:21:12 1990
  2. Received: from cs.utexas.edu by uunet.uu.net (5.61/1.14) with SMTP 
  3.     id AA15105; Thu, 6 Sep 90 18:21:12 -0400
  4. Posted-Date: 6 Sep 90 20:26:00 GMT
  5. Received: by cs.utexas.edu (5.64/1.76) 
  6. From: caywood@teb.larc.nasa.gov (John Caywood)
  7. Newsgroups: comp.std.unix
  8. Subject: Re: Query about P1003.2 'cp' utility
  9. Message-Id: <490@usenix.ORG>
  10. References: <DJM.90Aug17151613@jolt.eng.umd.edu> <439@usenix.ORG>
  11. Sender: std-unix@usenix.ORG
  12. Organization: NASA Langley Research Center, Hampton, VA  USA
  13. X-Submissions: std-unix@uunet.uu.net
  14. Date: 6 Sep 90 20:26:00 GMT
  15. Reply-To: std-unix@uunet.uu.net
  16. To: std-unix@uunet.uu.net
  17.  
  18. From:  caywood@teb.larc.nasa.gov (John Caywood)
  19.  
  20. In Volume 21, Number 42, djm@eng.umd.edu (David J. MacKenzie) writes:
  21. > In draft 10, cp never ever unlinks files.
  22. > In draft 10, all -f does in cp is turn off a previous -i.
  23. > I'm going to object to this on the FSF ballot; I think -f should make
  24. > it unlink (unconditionally), like it does for mv, ln, and rm, or else
  25. > not be specified at all in the standard, since it's not existing
  26. > practice.
  27.  
  28. Based on this article, I was about ready to submit an objection in
  29. support of the above.  On closer inspection, however, I think the
  30. objection is nullified by an earlier clause:
  31.    (3) If source_file exists....
  32.        (a) If dest_file exists....
  33.        [1] If -i is in effect....
  34.        [2] If dest_file isn't writable....
  35.        [3] A file descriptor shall be obtained by performing
  36.            actions equivalent to the POSIX.1 open() function
  37.            call using dest_file as the path argument, and the
  38.            bitwise inclusive OR of O_WRONLY and O_TRUNC as
  39.            the oflag argument.
  40.  
  41. I take this to mean that, no, cp doesn't unlink an existing file, but
  42. it truncates it upon opening under these conditions.  Consequently,
  43. yes, djm is correct, cp doesn't unlink.  I don't understand, though,
  44. why opening with O_TRUNC isn't equivalent.
  45.  
  46.    John Caywood, balloting .2 on behalf of NASA Langley Research Center
  47.  
  48. Volume-Number: Volume 21, Number 84
  49.  
  50.