🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Francois Pinard Fri, 01 Jan 1993 16:09
Problem with cp -pf and hard links
#1224
Author: Francois Pinard
Date: Fri, 01 Jan 1993 16:09
38 lines
2068 bytes
This relates to GNU fileutils 3.4, installed with GNU C 1.41 under
COFF encapsulation on this 386/ix 2.0.2 system.

The problem is that cp -pf destroy the hard link relationship of the
destination file, *if* that file was not writeable before the copy.

Here is the actual case.  I have ~/gnu/distrib/texinfo.tex (call it
$DESTIN) which is hard linked with texinfo.tex files in many
directories, used for making distributions.  $DESTIN has mode 444.
(This system does not have symbolic links.)  I am now unpacking a new
GNU package which provides a newer version of texinfo.tex, and want to
update not only $DESTIN from it, but also the hardlinked instances.

For reference, I have "cp() { /usr/local/gnubin/cp -i $*; }" in my
.bashrc, so all occurrences of cp imply -i.  If I merely execute:

	cp -pf texinfo.tex $DESTIN

with $DESTIN already existing with mode 444, then $DESTIN will receive
a copy of the newer texinfo with a hard link count of 1, while the
texinfo.tex's in the distribution directories stay undisturbed.

If I rather execute:

	chmod 644 $DESTIN
	cp -pf texinfo.tex $DESTIN

then $DESTIN will retain its previous hard link count and all copies
will be updated.  This is the behaviour I am expecting.

I would certainly need a cp, and even a mv, which reliably keeps the
previous hardlink relationships of the destination file, whatever the
destination file mode was.

-- 
Franc,ois Pinard       ``Happy GNU Year!''      pinard@iro.umontreal.ca
(514) 588-4656                                   ...!uunet!iros1!pinard
About the League for Programming Freedom?  Email me or lpf@uunet.uu.net
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads