home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / utils / bug / 2309 < prev    next >
Encoding:
Text File  |  1993-01-01  |  2.3 KB  |  79 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 (bis)
  5. Message-ID: <9301011852.AA06869@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 18:52:13 GMT
  11. Approved: bug-gnu-utils@prep.ai.mit.edu
  12. Lines: 65
  13.  
  14. Here is a script, hopefully reproducible, demonstrating the problem I
  15. recently described in a previous message.  Before trying it, execute
  16. first the equivalent of (I'm using bash):
  17.  
  18.     cp() { /usr/local/gnubin/cp -i $*; }
  19.     rm() { /usr/local/gnubin/rm -i $*; }
  20.  
  21. If I copy x3 over x1, x2 will be changed too (this is nice):
  22.  
  23. ~) echo a > x1
  24. ~) ln x1 x2
  25. ~) echo b > x3
  26. ~) v x*
  27. -rw-r-----   2 pinard   other           2 Jan  1 13:39 x1
  28. -rw-r-----   2 pinard   other           2 Jan  1 13:39 x2
  29. -rw-r-----   1 pinard   other           2 Jan  1 13:40 x3
  30. ~) cp -p x3 x1
  31. /usr/local/gnubin/cp: overwrite `x1'? y
  32. ~) v x*
  33. -rw-r-----   2 pinard   other           2 Jan  1 13:40 x1
  34. -rw-r-----   2 pinard   other           2 Jan  1 13:40 x2
  35. -rw-r-----   1 pinard   other           2 Jan  1 13:40 x3
  36. ~) cat x2
  37. b
  38.  
  39.  
  40. Clean up before retrying:
  41.  
  42. ~) rm x*
  43. /usr/local/gnubin/rm: remove `x1'? y
  44. /usr/local/gnubin/rm: remove `x2'? y
  45. /usr/local/gnubin/rm: remove `x3'? y
  46.  
  47.  
  48. I have to revert to using -f for the following to work, the hardlink
  49. relationship is broken.  Copying x3 over x1 does not change x2 (this
  50. is sad):
  51.  
  52. ~) echo a > x1
  53. ~) ln x1 x2
  54. ~) chmod 440 x1
  55. ~) echo b > x3
  56. ~) v x*
  57. -r--r-----   2 pinard   other           2 Jan  1 13:41 x1
  58. -r--r-----   2 pinard   other           2 Jan  1 13:41 x2
  59. -rw-r-----   1 pinard   other           2 Jan  1 13:41 x3
  60. ~) cp -p x3 x1
  61. /usr/local/gnubin/cp: overwrite `x1', overriding mode 0440? y
  62. /usr/local/gnubin/cp: cannot create regular file `x1': Permission denied
  63. ~) cp -pf x3 x1
  64. ~) v x*
  65. -rw-r-----   1 pinard   other           2 Jan  1 13:41 x1
  66. -r--r-----   1 pinard   other           2 Jan  1 13:41 x2
  67. -rw-r-----   1 pinard   other           2 Jan  1 13:41 x3
  68. ~) cat x2
  69. a
  70. ~) cat x1
  71. b
  72. ~) 
  73.  
  74. -- 
  75. Franc,ois Pinard       ``Happy GNU Year!''      pinard@iro.umontreal.ca
  76. (514) 588-4656                                   ...!uunet!iros1!pinard
  77. About the League for Programming Freedom?  Email me or lpf@uunet.uu.net
  78.  
  79.