[gedit-list] Gedit and Hard Links



Hi folks,

I am having problems editing a file which has more than one hard link to it on disk. The problem seems to come from the fact that the backup file is not another physical copy of the file, but the original file itself! And the file being edited is the copy. To demonstrate, I ran these commands:

$ echo 'some text' > file1
$ ln file1 file2
$ ls -i1
180819 file1
180819 file2

(this puts some text into file1, and creates a hard link to the same 'inode', called file2. The number printed in front of the filenames here is the inode number, and we can see that file1 and file2 are indeed links to the same inode)

$ gedit file2
   (run gedit on file2 and append the text 'some more text' )

$ more file2
some text
some more text

   (as I expected, the text has been properly appended in file2)

$ more file1
some text

   (contrary to what I expected, the text has NOT been appended in file1)

$ s -i1
180819 file1
192210 file2
180819 file2~

(this makes it clear what has happened. The backup file 'file2~' is a hard link to the same inode as file1, and file2 is a new file)

Does anyone know how to change this behavior in gedit? That is, to make gedit put the backup in a new inode, and leave the original file in the original inode?

$ gedit --version
Gnome gedit 2.10.3

Thanks,
Oran.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]