Redvers Davies [mailto:[EMAIL PROTECTED]] 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.

I beg to differ. I have had exposure to a number of O/S platforms and 
editors, and the behaviour you are implying is quirky to say the least.
The alternative behaviour of creating a new file, not overwriting the 
one that was linked to is more what is expected.

Consider what the editor is doing. It has been asked to write out its
editing buffer to a file (which may or may not exist). Frankly, the 
behaviour of "only clobber the file if there are no other links to it"
seems correct. The fact that SOMEONE ELSE may kave linked to that file, 
means that they are interested in the contents of the file now, not 
after I have frobbed it with my new version.

If the other person wanted always the latest version of my file, s/he 
should use a symbolic link instead. That's what symbolic links are for!

There is a perl analogy:

$a = "foo";
$b = $a;
$a = "bar";
print $b;       # prints "foo"

#===============================

$a = "foo";
*b = *a;
$a = "bar";
print $b;       # prints "bar"



Ivor.


-----------------------------------------------------------------------
The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of LIFFE (Holdings) Plc or any of its 
subsidiary companies.
-----------------------------------------------------------------------

Reply via email to