[cs631apue] problem about hard link
Jan Schaumann
jschauma at stevens.edu
Thu Sep 20 22:02:57 EDT 2012
Jan Schaumann <jschauma at stevens.edu> wrote:
> What system is this on? Can you copy and paste the exact output of:
>
> ln file1 file2
> ls -li file[12]
>
> then make a change to either file using emacs, write and exit emacs,
> then
>
> ls -li file[12]
Interesting!
On linux-lab.cs.stevens.edu, in your home directory (ie on an NFS shared
system), this is what you're reporting:
$ echo moo > file1
$ ln file1 file2
$ ls -li file[12]
41472 -rw-------+ 2 jschauma professor 4 Sep 20 21:57 file1
41472 -rw-------+ 2 jschauma professor 4 Sep 20 21:57 file2
$ emacs file2 # edit, C-x C-c
$ ls -li file[12]
41472 -rw-------+ 2 jschauma professor 4 Sep 20 21:57 file1
41476 -rw-------+ 1 jschauma professor 9 Sep 20 21:57 file2
$
That is, emacs writes the file to a temporary location, then renames it,
thus causing a separate copy.
Repeat the same with vi(1) instead of emacs, and you will find the
expected behaviour.
In my opinion, this is incorrect behaviour on emacs's side.
-Jan
More information about the cs631apue
mailing list