diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-11-03 13:31:48 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-11-14 09:09:47 +0200 |
commit | 643a8844a578ff146cfe746fe6091d29502b6c40 (patch) | |
tree | df750e9c66333371d15d17375800291789863a92 /src/incremen.c | |
parent | 099f71f78da3ef9a1aa525f070d93c87ed06cb98 (diff) | |
download | tar-643a8844a578ff146cfe746fe6091d29502b6c40.tar.gz |
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.
Diffstat (limited to 'src/incremen.c')
-rw-r--r-- | src/incremen.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/incremen.c b/src/incremen.c index 04b946f6..d5bc1e41 100644 --- a/src/incremen.c +++ b/src/incremen.c @@ -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) |