Thursday, July 10, 2014

Re: Problem with vimdiff and file name resolution

On 2014-07-10, Bram Moolenaar wrote:
> Gary Johnson wrote:
>
> > On one of the Linux machines on which I run Vim we run a backup
> > program which creates hourly and nightly backups of each user's home
> > directory in ~/.snapshot. The problem is that when I try to view
> > the differences between a file and its backup copy using vimdiff,
> > vimdiff resolves both file names to the same file.
> >
> > For example, the following command,
> >
> > $ vimdiff -N -u NONE -i NONE .snapshot/nightly.0/.configfiles/profile.common .configfiles/profile.common
> >
> > creates two vertically-split windows, but both windows contain the
> > same file, .snapshot/nightly.0/.configfiles/profile.common.
> >
> > I can view the differences by using just diff instead,
> >
> > $ diff .snapshot/nightly.0/.configfiles/profile.common .configfiles/profile.common
> >
> > and ls also shows them to be different files:
> >
> > $ ls -l .snapshot/nightly.0/.configfiles/profile.common .configfiles/profile.common
> > -rwx------ 1 gary gary 3523 Jul 9 13:09 .configfiles/profile.common
> > -rwx------ 1 gary gary 2992 Jul 7 10:07 .snapshot/nightly.0/.configfiles/profile.common
> >
> > This seems like a bug.
> >
> > I'm running 7.4.283 on Fedora 17 Linux.
>
> Did you check the inode numbers on the files? ls --inode.
> Vim checks if files are the same, ignoring links, by comparing the inode
> and devide number.

I was going to try that before, but thought it unnecessary since the
sizes and modification times were different. I tried it just now,
changing nightly.0 to nightly.1 because the backups have rotated.

$ ls -il .snapshot/nightly.1/.configfiles/profile.common .configfiles/profile.common
14988947 -rwx------ 1 gary gary 2269 Jul 9 15:00 .configfiles/profile.common
14988947 -rwx------ 1 gary gary 2992 Jul 7 10:07 .snapshot/nightly.1/.configfiles/profile.common

Sure enough, the inode numbers are the same! I then tried to find
out something about the file systems to which those directories
belong, but I don't understand the results.

$ df -h .configfiles
Filesystem Size Used Avail Use% Mounted on
fserver1b:/vol/users/gary/ 3.0T 1.6T 1.5T 53% /home/gary

$ df -h .snapshot/nightly.1/.configfiles
Filesystem Size Used Avail Use% Mounted on
fserver1b:/vol/users/gary/ 538G 270G 269G 51% /home/gary

The file systems have the same names, but different stats.

I've asked one of our IT guys to explain that to me.

It remains, though, that that "feature" of vimdiff is still causing
me difficulty. I haven't looked yet at the code that Christian
pointed me to, but it seems that if vimdiff is going to try for some
sort of optimization by checking inode numbers, it ought to check
file systems as well.

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment