On Mon, Jan 28, 2002 at 10:33:07AM +0000, Redvers Davies wrote:
> > I'm doing some rudimentary source management with cp -al foo foo-hck
> > and expecting that when I edit foo-hck/bar.pm that it'll do what emacs
> > does, write a new file called bar.pm in foo-hck, but instead it
> > doesn't disturb the hardlink at all and so modifies the pristine
> > version of the file too.
> 
> > Yes I know the simplest answer is to use emacs because it's sane, but
> 
> I would have thought that the behaviour you describe would be considered
> insane.
> 
> You set a hard link for a reason - that reason being that when
> you read and write to any of those "files" they all point to the same
> area of disk and therefor all change.  You are effectivly asking the
> editor to ignore the policy descision you made already.
> 
> If vi removed hard links on write I would move to another editor.
> 
> emacs-- # :-)
> 
> If that isn't the behaviour that you want... why use hard links?  Why
> not just copy the file?

Are you sure it's not symbolic links you want it to copy?  Surely when
you make a hard link to all intents and purposes the new entry is the
file.  How could any program tell what other hard links were made to an
inode without examining every directory on your disc.

It would make much more sense if it saw that you were editing a symlink
and copied the file over in that case.  Are you sure that's not the
behaviour you're remembering but trying to get it to do it for hard
links?

cheers

Andrew

Reply via email to