Hi I am sachin Puri  I am new linux user.  I have following observation in
case of vim editor and have some question regarding it so whole scenario is
like given below . What I have done and observe


Case 1 - I set all permissions  (rwx) for owner on parent directory. (I am
the owner.)
$ ls -ld dir
drwxrwxrwx 2 sachin sachin 4096 Mar 7 13:42 dir
and has structhure like below
/home/sachin/dir/text.text

In this case when editing the file "text.text", vim creates a temporary swap
file in that directory. When the file is saved, the swap file is deleted and
the inode number of "text.text" changes (it is different from the inode
number of the original file and also the swap file).

Case 2 - Write permission is removed from parent directory
$ ls -ld dir
dr-xr-xr-x 2 sachin sachin 4096 Mar 7 13:42 dir

In this case when editing the file "text.text", vim creates a temporary swap
file in /var/tmp. After saving the file, its inode does not change.


This means that in case 2, vim is updating the contents of the file
in-place. I have found that OpenOffice.org also updates the contents
in-place, irrespective of the parent directory permissions.

I wish to know why does vim create a new file in case 1. Wouldn't it be a
costly operation, especially in case of large files? In short, which method
is more efficient to implement for any file editor?

Please note that in all cases, all permissions are set on the file itself
(i.e. text.text). I am just manipulating the permissions of the parent
directory.

thanks in advance
-- 
http://mm.glug-bom.org/mailman/listinfo/linuxers

Reply via email to