home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / utils / bug / 2308 < prev    next >
Encoding:
Text File  |  1993-01-01  |  2.0 KB  |  53 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!icule.UUCP!pinard
  3. From: pinard@icule.UUCP (Francois Pinard)
  4. Subject: Problem with cp -pf and hard links
  5. Message-ID: <9301011609.AA06748@icule.UUCP>
  6. Sender: gnulists@ai.mit.edu
  7. Reply-To: pinard@iro.umontreal.ca
  8. Organization: GNUs Not Usenet
  9. Distribution: gnu
  10. Date: Fri, 1 Jan 1993 16:09:22 GMT
  11. Approved: bug-gnu-utils@prep.ai.mit.edu
  12. Lines: 39
  13.  
  14. This relates to GNU fileutils 3.4, installed with GNU C 1.41 under
  15. COFF encapsulation on this 386/ix 2.0.2 system.
  16.  
  17. The problem is that cp -pf destroy the hard link relationship of the
  18. destination file, *if* that file was not writeable before the copy.
  19.  
  20. Here is the actual case.  I have ~/gnu/distrib/texinfo.tex (call it
  21. $DESTIN) which is hard linked with texinfo.tex files in many
  22. directories, used for making distributions.  $DESTIN has mode 444.
  23. (This system does not have symbolic links.)  I am now unpacking a new
  24. GNU package which provides a newer version of texinfo.tex, and want to
  25. update not only $DESTIN from it, but also the hardlinked instances.
  26.  
  27. For reference, I have "cp() { /usr/local/gnubin/cp -i $*; }" in my
  28. .bashrc, so all occurrences of cp imply -i.  If I merely execute:
  29.  
  30.     cp -pf texinfo.tex $DESTIN
  31.  
  32. with $DESTIN already existing with mode 444, then $DESTIN will receive
  33. a copy of the newer texinfo with a hard link count of 1, while the
  34. texinfo.tex's in the distribution directories stay undisturbed.
  35.  
  36. If I rather execute:
  37.  
  38.     chmod 644 $DESTIN
  39.     cp -pf texinfo.tex $DESTIN
  40.  
  41. then $DESTIN will retain its previous hard link count and all copies
  42. will be updated.  This is the behaviour I am expecting.
  43.  
  44. I would certainly need a cp, and even a mv, which reliably keeps the
  45. previous hardlink relationships of the destination file, whatever the
  46. destination file mode was.
  47.  
  48. -- 
  49. Franc,ois Pinard       ``Happy GNU Year!''      pinard@iro.umontreal.ca
  50. (514) 588-4656                                   ...!uunet!iros1!pinard
  51. About the League for Programming Freedom?  Email me or lpf@uunet.uu.net
  52.  
  53.