Loading ...
Sorry, an error occurred while loading the content.

Problem with vimdiff and file name resolution

Expand Messages
  • Gary Johnson
    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.
    Message 1 of 15 , Jul 9, 2014
    • 0 Attachment
      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.

      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@....
      For more options, visit https://groups.google.com/d/optout.
    • Christian Brabandt
      Hi Gary! ... Is there an easy way to reproduce the issue? It somehow sounds, like Vim is thinking the second argument as a directory and uses the same file
      Message 2 of 15 , Jul 10, 2014
      • 0 Attachment
        Hi Gary!

        On Mi, 09 Jul 2014, 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.

        Is there an easy way to reproduce the issue? It somehow sounds, like
        Vim is thinking the second argument as a directory and uses the same
        file again. What happens, if you swap the arguments?

        Best,
        Christian
        --
        Das Ei darf nicht klüger sein als Kolumbus.
        -- Heinz Erhardt

        --
        --
        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@....
        For more options, visit https://groups.google.com/d/optout.
      • Gary Johnson
        ... Swapping the arguments causes vimdiff to open .configfiles/profile.common in both windows. In both cases, vimdiff opens the first file in both windows.
        Message 3 of 15 , Jul 10, 2014
        • 0 Attachment
          On 2014-07-10, Christian Brabandt wrote:
          > Hi Gary!
          >
          > On Mi, 09 Jul 2014, 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.
          >
          > Is there an easy way to reproduce the issue? It somehow sounds, like
          > Vim is thinking the second argument as a directory and uses the same
          > file again. What happens, if you swap the arguments?

          Swapping the arguments causes vimdiff to open
          .configfiles/profile.common in both windows. In both cases, vimdiff
          opens the first file in both windows.

          I'll work on a way to reproduce it.

          Thanks,
          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@....
          For more options, visit https://groups.google.com/d/optout.
        • Christian Brabandt
          ... If you have a chance, take a look at main.c line 2389 That changes the arguments for the files. Best, Christian -- Es verlohnt sich nicht, daß man alle
          Message 4 of 15 , Jul 10, 2014
          • 0 Attachment
            On Do, 10 Jul 2014, Gary Johnson wrote:

            > I'll work on a way to reproduce it.

            If you have a chance, take a look at main.c line 2389
            That changes the arguments for the files.

            Best,
            Christian
            --
            Es verlohnt sich nicht, daß man alle Bücher widerlegt. Exzerpieren
            isoliert und hebt eine Sache heraus.
            -- Jean Paul

            --
            --
            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@....
            For more options, visit https://groups.google.com/d/optout.
          • Bram Moolenaar
            ... 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. --
            Message 5 of 15 , Jul 10, 2014
            • 0 Attachment
              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.

              --
              [Another hideous roar.]
              BEDEVERE: That's it!
              ARTHUR: What?
              BEDEVERE: It's The Legendary Black Beast of Aaaaarrrrrrggghhh!
              "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
              \\\ an exciting new programming language -- http://www.Zimbu.org ///
              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

              --
              --
              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@....
              For more options, visit https://groups.google.com/d/optout.
            • Gary Johnson
              ... 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
              Message 6 of 15 , Jul 10, 2014
              • 0 Attachment
                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@....
                For more options, visit https://groups.google.com/d/optout.
              • Gary Johnson
                ... I haven t figured out how to distinguish the two file systems. The stat command indicates that the device numbers (%d) are the same, $ stat --format= %d
                Message 7 of 15 , Jul 10, 2014
                • 0 Attachment
                  On 2014-07-10, Gary Johnson wrote:
                  > On 2014-07-10, Bram Moolenaar wrote:

                  > > 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.

                  I haven't figured out how to distinguish the two file systems. The
                  stat command indicates that the device numbers (%d) are the same,

                  $ stat --format="%d %i %m %n" .snapshot/nightly.1/.configfiles/profile.common .configfiles/profile.common
                  37 14988947 /home/gary .snapshot/nightly.1/.configfiles/profile.common
                  37 14988947 /home/gary .configfiles/profile.common

                  and that the file system IDs (%i) are the same,

                  $ stat -f --format="%i %b %n" .snapshot/nightly.1/.configfiles/profile.common .configfiles/profile.common
                  0 17616077 .snapshot/nightly.1/.configfiles/profile.common
                  0 99824436 .configfiles/profile.common

                  I included the total data blocks in the file systems (%b) in the
                  second result to help confirm that the file systems are indeed
                  different.

                  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@....
                  For more options, visit https://groups.google.com/d/optout.
                • Gary Johnson
                  ... I had a chat with our IT guy. It turns out that our short-term backup system, the one that periodically saves files to the ~/.snapshot directory, uses its
                  Message 8 of 15 , Jul 10, 2014
                  • 0 Attachment
                    On 2014-07-10, Gary Johnson wrote:
                    > On 2014-07-10, Gary Johnson wrote:
                    > > On 2014-07-10, Bram Moolenaar wrote:
                    >
                    > > > 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.
                    >
                    > I haven't figured out how to distinguish the two file systems. The
                    > stat command indicates that the device numbers (%d) are the same,
                    >
                    > $ stat --format="%d %i %m %n" .snapshot/nightly.1/.configfiles/profile.common .configfiles/profile.common
                    > 37 14988947 /home/gary .snapshot/nightly.1/.configfiles/profile.common
                    > 37 14988947 /home/gary .configfiles/profile.common
                    >
                    > and that the file system IDs (%i) are the same,
                    >
                    > $ stat -f --format="%i %b %n" .snapshot/nightly.1/.configfiles/profile.common .configfiles/profile.common
                    > 0 17616077 .snapshot/nightly.1/.configfiles/profile.common
                    > 0 99824436 .configfiles/profile.common
                    >
                    > I included the total data blocks in the file systems (%b) in the
                    > second result to help confirm that the file systems are indeed
                    > different.

                    I had a chat with our IT guy. It turns out that our short-term
                    backup system, the one that periodically saves files to the
                    ~/.snapshot directory, uses its own file system (perhaps a database
                    made to look like a file system) that preserves the inode numbers of
                    backed up files, as you can see in this output of ls.

                    $ ls -li .configfiles/profile.common .snapshot/*/.configfiles/profile.common
                    14988947 -rwx------ 1 gary gary 2269 Jul 9 15:00 .configfiles/profile.common
                    14988947 -rwx------ 1 gary gary 2269 Jul 9 15:00 .snapshot/hourly.0/.configfiles/profile.common
                    14988947 -rwx------ 1 gary gary 2269 Jul 9 15:00 .snapshot/hourly.1/.configfiles/profile.common
                    14988947 -rwx------ 1 gary gary 2269 Jul 9 15:00 .snapshot/hourly.2/.configfiles/profile.common
                    14988947 -rwx------ 1 gary gary 2269 Jul 9 15:00 .snapshot/hourly.3/.configfiles/profile.common
                    14988947 -rwx------ 1 gary gary 3676 Jul 9 11:57 .snapshot/hourly.4/.configfiles/profile.common
                    14988947 -rwx------ 1 gary gary 2992 Jul 7 10:07 .snapshot/hourly.5/.configfiles/profile.common
                    14988947 -rwx------ 1 gary gary 2269 Jul 9 15:00 .snapshot/nightly.0/.configfiles/profile.common
                    14988947 -rwx------ 1 gary gary 2992 Jul 7 10:07 .snapshot/nightly.1/.configfiles/profile.common

                    I also browsed through the Vim code for "inode". It appears that
                    Vim uses the inode number and the device number whenever it can to
                    determine whether two files are the same.

                    It would agree that if the inode numbers of two files are different,
                    it is safe to conclude that the files are different. However, as
                    observed here and as noted at lines 4639 and 4670 of memline.c, it
                    is not safe to assume that if the inode numbers of two files are
                    equal, the files are equal. It might be better if another test was
                    used to verify whether two files having the same inode numbers are
                    actually the same. This is done anyway on file systems without
                    inodes.

                    On the other hand, a file system such as we're using for backups
                    seems pretty unusual, and equal inode numbers over network file
                    systems is also pretty rare. Is this problem worth fixing? Would a
                    patch even be considered? Or should I just resort to workarounds
                    for the few times I have to recover part of a file?

                    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@....
                    For more options, visit https://groups.google.com/d/optout.
                  • Erik Christiansen
                    ... How many minutes would it take to bang together a shellscript wrapper around vimdiff, to copy one of the files to /tmp/fred, and vimdiff that? Erik -- All
                    Message 9 of 15 , Jul 11, 2014
                    • 0 Attachment
                      On 10.07.14 16:54, Gary Johnson wrote:
                      > On the other hand, a file system such as we're using for backups
                      > seems pretty unusual, and equal inode numbers over network file
                      > systems is also pretty rare. Is this problem worth fixing? Would a
                      > patch even be considered? Or should I just resort to workarounds
                      > for the few times I have to recover part of a file?

                      How many minutes would it take to bang together a shellscript wrapper
                      around vimdiff, to copy one of the files to /tmp/fred, and vimdiff that?

                      Erik

                      --
                      "All we are given is possibilities -- to make ourselves one thing or another." - Ortega y Gasset

                      --
                      --
                      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@....
                      For more options, visit https://groups.google.com/d/optout.
                    • Павлов Николай Алекса
                      ... Hash: SHA512 ... One can use vimdiff
                      Message 10 of 15 , Jul 11, 2014
                      • 0 Attachment
                        -----BEGIN PGP SIGNED MESSAGE-----
                        Hash: SHA512

                        On July 11, 2014 11:38:15 AM GMT+03:00, Erik Christiansen <dvalin@...> wrote:
                        >On 10.07.14 16:54, Gary Johnson wrote:
                        >> On the other hand, a file system such as we're using for backups
                        >> seems pretty unusual, and equal inode numbers over network file
                        >> systems is also pretty rare. Is this problem worth fixing? Would a
                        >> patch even be considered? Or should I just resort to workarounds
                        >> for the few times I have to recover part of a file?
                        >
                        >How many minutes would it take to bang together a shellscript wrapper
                        >around vimdiff, to copy one of the files to /tmp/fred, and vimdiff
                        >that?
                        >
                        >Erik
                        >
                        >--
                        >"All we are given is possibilities -- to make ourselves one thing or
                        >another."
                        > - Ortega y Gasset
                        >
                        >--
                        >--
                        >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@....
                        >For more options, visit https://groups.google.com/d/optout.

                        One can use

                        vimdiff <(cat file1) <(cat file2)

                        (bash, zsh). This variant does not allow one to edit files though.
                        -----BEGIN PGP SIGNATURE-----
                        Version: APG v1.1.1

                        iQI1BAEBCgAfBQJTv5ZYGBxaeVggPHp5eC52aW1AZ21haWwuY29tPgAKCRCf3UKj
                        HhHSvsjrD/sHNc7VevSyxistNtFDxcvvhHadhtCQ5pVh/RdKfBoOwoVXB1wSNnqq
                        Ax3AVBZjuZ0JjX3XbDqRKwTYCg/S9gbtOyAuOPy0Ul5iZLvTAgm3KrGXbgGqjfgh
                        O+E+ZKjbhN7RGkRLYURbCNHXIF42Rej8MSMU1AMPwLT6H0M+v4kLTD8qNzss77Ga
                        pha+39e+JGMSMXBjFnLF9CJNpztHZ2GygOhxsOjjUxEK+3RKqb0A0gmBidVeLoE8
                        2UslRZQjaoLMj8ez+9tSMpob/1BlRBvRV84PWooc6NyL4ER8Wp8YrVTzVEk5qUw/
                        ZyN4EIu6dIh+FZBJR8D6/zPp+tIHoxobmNYlGkG5AC3OFnMJAPVwHRYzEFxMFXgW
                        /TgQCLRw2h3h0F2EbKW733ojCKlY9ew2I+fAv6dgAndI18MuNg8h+c26Bco75kak
                        5BqhSUC7/nZn4TwIYnRY5ghu1vuU5Kj0UyXjl/25d6zphG//SPaq/tcDsKdL7DJB
                        EBYvXwTDmZbUZuJldlzjw/dDTG6EaiaYcPu+3F5xgw3CZqSPdaHD0CbisY3DWYE8
                        p5gc7oOB6+tBGm7is3/kVty0+jnzHVK/p1D0pmoEzJjkohJA2GGVn7tpToGqycum
                        dCi1nL35V4LgXrZnmtlVN2U1hH7T+wWRixe24a46DIZyKTe2yvvYXQ==
                        =sYnG
                        -----END PGP SIGNATURE-----

                        --
                        --
                        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@....
                        For more options, visit https://groups.google.com/d/optout.
                      • Christian Brabandt
                        ... FWIW: In my opinion, vimdiff should just work[TM], so I would like to have your fix included. Because if one ever stumbles over your issue, it s not easy
                        Message 11 of 15 , Jul 11, 2014
                        • 0 Attachment
                          Am 2014-07-11 01:54, schrieb Gary Johnson:
                          > On the other hand, a file system such as we're using for backups
                          > seems pretty unusual, and equal inode numbers over network file
                          > systems is also pretty rare. Is this problem worth fixing? Would a
                          > patch even be considered? Or should I just resort to workarounds
                          > for the few times I have to recover part of a file?

                          FWIW: In my opinion, vimdiff should just work[TM], so I would like to
                          have your fix included. Because if one ever stumbles over your issue,
                          it's not easy to understand why it happens (if one even notices, that
                          the bug really happened rather than thinking, "Oh those files must be
                          the
                          same, if vimdiff doesn't show me a differenc...")

                          Best,
                          Christian

                          --
                          --
                          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@....
                          For more options, visit https://groups.google.com/d/optout.
                        • Gary Johnson
                          ... That s close to the workaround I actually used. I wanted to edit the current copy with the backup copy as reference, so I did this: vimdiff
                          Message 12 of 15 , Jul 11, 2014
                          • 0 Attachment
                            On 2014-07-11, Павлов Николай Александрович wrote:

                            > On July 11, 2014 11:38:15 AM GMT+03:00, Erik Christiansen wrote:
                            > >On 10.07.14 16:54, Gary Johnson wrote:
                            > >> On the other hand, a file system such as we're using for backups
                            > >> seems pretty unusual, and equal inode numbers over network file
                            > >> systems is also pretty rare. Is this problem worth fixing? Would a
                            > >> patch even be considered? Or should I just resort to workarounds
                            > >> for the few times I have to recover part of a file?
                            > >
                            > >How many minutes would it take to bang together a shellscript wrapper
                            > >around vimdiff, to copy one of the files to /tmp/fred, and vimdiff
                            > >that?

                            > One can use
                            >
                            > vimdiff <(cat file1) <(cat file2)

                            That's close to the workaround I actually used. I wanted to edit
                            the current copy with the backup copy as reference, so I did this:

                            vimdiff <(cat backup) current

                            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@....
                            For more options, visit https://groups.google.com/d/optout.
                          • Bram Moolenaar
                            ... It s not vimdiff, if you try to edit both files in any other way you most likely run into the same problem, that Vim thinks they are the same file. And
                            Message 13 of 15 , Jul 11, 2014
                            • 0 Attachment
                              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.

                              It's not vimdiff, if you try to edit both files in any other way you
                              most likely run into the same problem, that Vim thinks they are the same
                              file. And will load only the first one. This is to catch hard links.

                              --
                              ROBIN: (warily) And if you get a question wrong?
                              ARTHUR: You are cast into the Gorge of Eternal Peril.
                              ROBIN: Oh ... wacho!
                              "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

                              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                              \\\ an exciting new programming language -- http://www.Zimbu.org ///
                              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                              --
                              --
                              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@....
                              For more options, visit https://groups.google.com/d/optout.
                            • Jeff Fisher
                              Hello, It looks like you are using a netapp filer to store the files. The netapp uses filesystem snapshots to make backups of the files, then mounts these
                              Message 14 of 15 , Jul 12, 2014
                              • 0 Attachment

                                Hello,

                                It looks like you are using a netapp filer to store the files.

                                The netapp uses filesystem snapshots to make backups of the files, then mounts these snapshots under the root of the mount point. On the netapp side, they are two distinct file systems. However, on the client side, it is a single NFS-mount, so the Linux client considers it a single filesystem (as it should, according to the NFS protocol.)

                                Unfortunately, the only ways that I know of to differentiate are:

                                * With realpath(), which would then misinterpret hard links.
                                * To walk up the filesystem looking for directories with the same filesystem and inode number, which is similar to how the find command detects filesystem loops, but would break in the case of a real file system loop.

                                Both are tradeoffs, but the second option seems the more natural method.

                                Hope this helps.

                                Best Regards,
                                Jeff

                                On Jul 11, 2014 1:55 AM, "Gary Johnson" <garyjohn@...> wrote:
                                On 2014-07-10, Gary Johnson wrote:
                                > On 2014-07-10, Gary Johnson wrote:
                                > > On 2014-07-10, Bram Moolenaar wrote:
                                >
                                > > > 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.
                                >
                                > I haven't figured out how to distinguish the two file systems.  The
                                > stat command indicates that the device numbers (%d) are the same,
                                >
                                >     $ stat --format="%d %i %m %n" .snapshot/nightly.1/.configfiles/profile.common .configfiles/profile.common
                                >     37 14988947 /home/gary .snapshot/nightly.1/.configfiles/profile.common
                                >     37 14988947 /home/gary .configfiles/profile.common
                                >
                                > and that the file system IDs (%i) are the same,
                                >
                                >     $ stat -f --format="%i %b %n" .snapshot/nightly.1/.configfiles/profile.common .configfiles/profile.common
                                >     0 17616077 .snapshot/nightly.1/.configfiles/profile.common
                                >     0 99824436 .configfiles/profile.common
                                >
                                > I included the total data blocks in the file systems (%b) in the
                                > second result to help confirm that the file systems are indeed
                                > different.

                                I had a chat with our IT guy.  It turns out that our short-term
                                backup system, the one that periodically saves files to the
                                ~/.snapshot directory, uses its own file system (perhaps a database
                                made to look like a file system) that preserves the inode numbers of
                                backed up files, as you can see in this output of ls.

                                    $ ls -li .configfiles/profile.common .snapshot/*/.configfiles/profile.common
                                    14988947 -rwx------ 1 gary gary 2269 Jul  9 15:00 .configfiles/profile.common
                                    14988947 -rwx------ 1 gary gary 2269 Jul  9 15:00 .snapshot/hourly.0/.configfiles/profile.common
                                    14988947 -rwx------ 1 gary gary 2269 Jul  9 15:00 .snapshot/hourly.1/.configfiles/profile.common
                                    14988947 -rwx------ 1 gary gary 2269 Jul  9 15:00 .snapshot/hourly.2/.configfiles/profile.common
                                    14988947 -rwx------ 1 gary gary 2269 Jul  9 15:00 .snapshot/hourly.3/.configfiles/profile.common
                                    14988947 -rwx------ 1 gary gary 3676 Jul  9 11:57 .snapshot/hourly.4/.configfiles/profile.common
                                    14988947 -rwx------ 1 gary gary 2992 Jul  7 10:07 .snapshot/hourly.5/.configfiles/profile.common
                                    14988947 -rwx------ 1 gary gary 2269 Jul  9 15:00 .snapshot/nightly.0/.configfiles/profile.common
                                    14988947 -rwx------ 1 gary gary 2992 Jul  7 10:07 .snapshot/nightly.1/.configfiles/profile.common

                                I also browsed through the Vim code for "inode".  It appears that
                                Vim uses the inode number and the device number whenever it can to
                                determine whether two files are the same.

                                It would agree that if the inode numbers of two files are different,
                                it is safe to conclude that the files are different.  However, as
                                observed here and as noted at lines 4639 and 4670 of memline.c, it
                                is not safe to assume that if the inode numbers of two files are
                                equal, the files are equal.  It might be better if another test was
                                used to verify whether two files having the same inode numbers are
                                actually the same.  This is done anyway on file systems without
                                inodes.

                                On the other hand, a file system such as we're using for backups
                                seems pretty unusual, and equal inode numbers over network file
                                systems is also pretty rare.  Is this problem worth fixing?  Would a
                                patch even be considered?  Or should I just resort to workarounds
                                for the few times I have to recover part of a file?

                                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@....
                                For more options, visit https://groups.google.com/d/optout.

                                --
                                --
                                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@....
                                For more options, visit https://groups.google.com/d/optout.
                              • Gary Johnson
                                ... I thought it should just work , too, and would be worth the effort to fix. However, as I thought more about my initial solution, I realized that it
                                Message 15 of 15 , Jul 17, 2014
                                • 0 Attachment
                                  On 2014-07-11, Christian Brabandt wrote:
                                  > Am 2014-07-11 01:54, schrieb Gary Johnson:
                                  > >On the other hand, a file system such as we're using for backups
                                  > >seems pretty unusual, and equal inode numbers over network file
                                  > >systems is also pretty rare. Is this problem worth fixing? Would a
                                  > >patch even be considered? Or should I just resort to workarounds
                                  > >for the few times I have to recover part of a file?
                                  >
                                  > FWIW: In my opinion, vimdiff should just work[TM], so I would like to
                                  > have your fix included. Because if one ever stumbles over your issue,
                                  > it's not easy to understand why it happens (if one even notices, that
                                  > the bug really happened rather than thinking, "Oh those files must be
                                  > the
                                  > same, if vimdiff doesn't show me a differenc...")

                                  I thought it should "just work", too, and would be worth the effort
                                  to fix. However, as I thought more about my initial solution, I
                                  realized that it wouldn't work in all cases and would just trade off
                                  one weird behavior for another.

                                  As Jeff Fisher explained (thanks, Jeff), the NetApp filer takes
                                  liberties with the Linux file system model and doesn't give the user
                                  a means to uniquely identify files by device number and inode
                                  number. I think the fault here clearly lies with NetApp and not
                                  with Vim.

                                  I often use ranger and the RangerChooser command to browse for files
                                  within Vim. I now have a fix for the RangerChooser command that
                                  works around this problem.

                                  I thought that I could use the BufReadCmd event to create a plugin
                                  that would work around this problem when opening a file directly
                                  from Vim, but no luck. It appears that as soon as Vim sees a file
                                  name, it notes its inode number, even if it never opens the file,
                                  and uses that inode number to optimize file accesses. That's been a
                                  bit frustrating. I don't know whether or not that optimization is
                                  over-zealous and could be improved for the purpose of working around
                                  this issue with an autocommand. My feeling is that Bram knew what
                                  he was doing when he wrote that part of the code and that I would
                                  have to know a lot more than I do about Vim to try to improve that
                                  without breaking something, all to fix a problem that is not really
                                  Vim's.

                                  Others have proposed reasonable workarounds that are good enough for
                                  my purposes, so I think I'll live with those.

                                  Thanks everyone for your comments. It's been an education.

                                  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@....
                                  For more options, visit https://groups.google.com/d/optout.
                                Your message has been successfully submitted and would be delivered to recipients shortly.