bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] tar c --listed-incremental --no-check-device is over-zealous


From: Sid Vaughan
Subject: [Bug-tar] tar c --listed-incremental --no-check-device is over-zealous
Date: Wed, 19 Feb 2014 20:17:15 +0000

Dear fellow archivists,

Have any of you noticed that 1.26 to 1.27.1 behave incorrectly when
creating incremental archives if the device number differs between
dumps?

Using the above options if I create a snapshot of a local filesystem,
dump it and then create another snapshot and dump that, the second
invocation of tar performs what amounts to a level 0 dump despite no
files having changed. This occurs because this segment of code in
src/incremen.c is not quite correct:

      /* With NFS, the same file can have two different devices
         if an NFS directory is mounted in multiple locations,
         which is relatively common when automounting.
         To avoid spurious incremental redumping of
         directories, consider all NFS devices as equal,
         relying on the i-node to establish differences.  */

      if (! ((!check_device_option
              || (DIR_IS_NFS (directory) && nfs)
              || directory->device_number == stat_data->st_dev)
             && directory->inode_number == stat_data->st_ino))
        {
          /* FIXME: find_directory_meta ignores nfs */
          struct directory *d = find_directory_meta (stat_data->st_dev,
                                                     stat_data->st_ino);

The problem is that despite --no-check-devices being specified, the
hash table which stores the details from the snapshot file contains the
old device number. This means find_directory_meta() always returns
NULL, as the comment indicates.

ISTM if the user specifies --no-check-devices the hash table should be
loaded from the snapshot file with the device number set to 0. In this
case the above function call could be replaced with:

... find_directory_meta( check_device_option ? stat_data->st_dev : 0,
                         stat_data->st_ino );

and further entries in the hash table also be built with 
device_number=0. Is this all that is necessary, or will this kind of
fix upset other aspects of tar?

Comments?

Yours,

Sid.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]