Fix creation of incremental archives when a subdirectory becomes a mountpoint.

When used with --listed-incrfental and --one-file-system, tar
was unable to cope with directories that had once been part of the
dumped system and became separate mount points afterwards.  The bug
has been reported and a fix proposed by Nathan Stratton Treadway.

* src/incremen.c (procdir): If one_file_system_option is in effect,
clear out dumpdir info from the directory.
* tests/Makefile.am: Add new testcase.
* tests/listed05.at: New testcase.
* tests/testsuite.at (AT_PRIVILEGED_PREREQ): New macro.
include listed05.at.
* THANKS: Update.
This commit is contained in:
Sergey Poznyakoff
2012-11-14 09:09:47 +02:00
parent 099f71f78d
commit 643a8844a5
5 changed files with 112 additions and 11 deletions
+23 -11
View File
@@ -446,7 +446,8 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
struct directory *directory;
struct stat *stat_data = &st->stat;
bool nfs = NFS_FILE_STAT (*stat_data);
bool perhaps_renamed = false;
if ((directory = find_directory (name_buffer)) != NULL)
{
if (DIR_IS_INITED (directory))
@@ -500,9 +501,7 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
}
else
{
WARNOPT (WARN_RENAME_DIRECTORY,
(0, 0, _("%s: Directory has been renamed"),
quotearg_colon (name_buffer)));
perhaps_renamed = true;
directory->children = ALL_CHILDREN;
directory->device_number = stat_data->st_dev;
directory->inode_number = stat_data->st_ino;
@@ -560,13 +559,21 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
if (one_file_system_option && st->parent
&& stat_data->st_dev != st->parent->stat.st_dev)
/* FIXME:
WARNOPT (WARN_XDEV,
(0, 0,
_("%s: directory is on a different filesystem; not dumped"),
quotearg_colon (directory->name)));
*/
directory->children = NO_CHILDREN;
{
WARNOPT (WARN_XDEV,
(0, 0,
_("%s: directory is on a different filesystem; not dumped"),
quotearg_colon (directory->name)));
directory->children = NO_CHILDREN;
/* If there is any dumpdir info in that directory, remove it */
if (directory->dump)
{
dumpdir_free (directory->dump);
directory->dump = NULL;
}
perhaps_renamed = false;
}
else if (flag & PD_FORCE_CHILDREN)
{
directory->children = PD_CHILDREN(flag);
@@ -574,6 +581,11 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
*entry = 'N';
}
if (perhaps_renamed)
WARNOPT (WARN_RENAME_DIRECTORY,
(0, 0, _("%s: Directory has been renamed"),
quotearg_colon (name_buffer)));
DIR_SET_FLAG (directory, DIRF_INIT);
if (directory->children != NO_CHILDREN)