]> Dogcows Code - chaz/tar/commitdiff
* src/names.c: tar: fix bug with --one-file-system --listed-incremental
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 23 Nov 2010 06:50:58 +0000 (22:50 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 23 Nov 2010 06:51:29 +0000 (22:51 -0800)
Problem (and idea for fix) reported by Martin Weigel
<http://lists.gnu.org/archive/html/bug-tar/2010-11/msg00071.html>.
* src/common.h (is_individual_file): Remove decl.
* src/create.c (dump_file0): Replace "is_individual_file (p)"
with "top_level".
* src/incremen.c (procdir): Replace "!is_individual_file
(name_buffer)" with "st->parent".  Fix bug with --one-file-system
and --listed-incremental.
* src/names.c (individual_file_table, register_individual_file):
(is_individual_file): Remove.  All uses removed.

src/common.h
src/create.c
src/incremen.c
src/names.c

index 35e056ed7bd84457e367676a18895c8e847237c2..9444fd7f5563d550230862f583e162604d1d4dcc 100644 (file)
@@ -680,7 +680,6 @@ bool excluded_name (char const *name);
 
 void add_avoided_name (char const *name);
 bool is_avoided_name (char const *name);
-bool is_individual_file (char const *name);
 
 bool contains_dot_dot (char const *name);
 
index a1e90a33679f12b0119953cbf465d64bd1e21eb5..e8de6b92463708620ed2abc937f24550d3b5020a 100644 (file)
@@ -1678,9 +1678,9 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
      put in the archive.
 
      This check is omitted if incremental_option is set *and* the
-     requested file is not explicitely listed in the command line. */
+     requested file is not explicitly listed in the command line.  */
 
-  if (!(incremental_option && !is_individual_file (p))
+  if (! (incremental_option && ! top_level)
       && !S_ISDIR (st->stat.st_mode)
       && OLDER_TAR_STAT_TIME (*st, m)
       && (!after_date_option || OLDER_TAR_STAT_TIME (*st, c)))
index 628ff296dc13036c7d22f3271a19b700ca1c1991..2b33c5d1380843bf6ccc624dc153910496181a3b 100644 (file)
@@ -426,7 +426,6 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
 {
   struct directory *directory;
   struct stat *stat_data = &st->stat;
-  dev_t device = st->parent ? st->parent->stat.st_dev : 0;
   bool nfs = NFS_FILE_STAT (*stat_data);
 
   if ((directory = find_directory (name_buffer)) != NULL)
@@ -540,11 +539,8 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
        }
     }
 
-  /* If the directory is on another device and --one-file-system was given,
-     omit it... */
-  if (one_file_system_option && device != stat_data->st_dev
-      /* ... except if it was explicitely given in the command line */
-      && !is_individual_file (name_buffer))
+  if (one_file_system_option && st->parent
+      && stat_data->st_dev != st->parent->stat.st_dev)
     /* FIXME:
        WARNOPT (WARN_XDEV,
                 (0, 0,
index 6e214bfa71e5d0c7854618288ecd8f504078359b..ba4d509e47ead3bfd99846250f05c623878a11c8 100644 (file)
@@ -47,8 +47,6 @@ static char *cached_no_such_gname;
 static uid_t cached_no_such_uid;
 static gid_t cached_no_such_gid;
 
-static void register_individual_file (char const *name);
-
 /* Given UID, find the corresponding UNAME.  */
 void
 uid_to_uname (uid_t uid, char **uname)
@@ -360,8 +358,6 @@ name_next_elt (int change_dirs)
        {
          if (unquote_option)
            unquote_string (name_buffer);
-         if (incremental_option)
-           register_individual_file (name_buffer);
          entry.type = ep->type;
          entry.v.name = name_buffer;
          return &entry;
@@ -1151,28 +1147,6 @@ excluded_name (char const *name)
 {
   return excluded_file_name (excluded, name + FILE_SYSTEM_PREFIX_LEN (name));
 }
-\f
-static Hash_table *individual_file_table;
-
-static void
-register_individual_file (char const *name)
-{
-  struct stat st;
-
-  if (deref_stat (name, &st) != 0)
-    return; /* Will be complained about later */
-  if (S_ISDIR (st.st_mode))
-    return;
-
-  hash_string_insert (&individual_file_table, name);
-}
-
-bool
-is_individual_file (char const *name)
-{
-  return hash_string_lookup (individual_file_table, name);
-}
-
 \f
 
 /* Return the size of the prefix of FILE_NAME that is removed after
This page took 0.024089 seconds and 4 git commands to generate.