bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] -A/catenate/concatenate with -g/listed-incremental: stat n


From: Sergey Poznyakoff
Subject: Re: [Bug-tar] -A/catenate/concatenate with -g/listed-incremental: stat no such file or directory
Date: Thu, 16 Apr 2015 08:19:27 +0300

Alex Efros <address@hidden> ha escrit:

> Same error on 1.27.1 and 1.28:

My apologies, I've sent you a malformed patch.  Please find attached the
correct version.

> I create full.tar once per week, and then every day create incr.tar and
> concatenate it to full.tar. The idea was to have fast backups and at same
> time just one file for restore. Am I doing something wrong?

No, not at all.  That sounds quite reasonable, indeed.  Thanks for
explanation.

Regards,
Sergey

diff --git a/src/common.h b/src/common.h
index 20cbb64..2904183 100644
--- a/src/common.h
+++ b/src/common.h
@@ -523,6 +523,8 @@ void extract_archive (void);
 void extract_finish (void);
 bool rename_directory (char *src, char *dst);

+void remove_delayed_set_stat (const char *fname);
+
 /* Module delete.c.  */

 void delete_archive_members (void);
diff --git a/src/extract.c b/src/extract.c
index ca25603..73ff6c1 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -537,6 +537,37 @@ repair_delayed_set_stat (char const *dir,
          quotearg_colon (dir)));
 }

+static void
+free_delayed_set_stat (struct delayed_set_stat *data)
+{
+  xheader_xattr_free (data->xattr_map, data->xattr_map_size);
+  free (data->cntx_name);
+  free (data->acls_a_ptr);
+  free (data->acls_d_ptr);
+  free (data);
+}
+
+void
+remove_delayed_set_stat (const char *fname)
+{
+  struct delayed_set_stat *data, *next, *prev = NULL;
+  for (data = delayed_set_stat_head; data; data = next)
+    {
+      next = data->next;
+      if (strcmp (data->file_name, fname) == 0)
+       {
+         free_delayed_set_stat (data);
+         if (prev)
+           prev->next = next;
+         else
+           delayed_set_stat_head = next;
+         return;
+       }
+      else
+       prev = data;
+    }
+}
+
 /* After a file/link/directory creation has failed, see if
    it's because some required directory was not present, and if so,
    create all required directories.  Return zero if all the required
@@ -846,11 +877,7 @@ apply_nonancestor_delayed_set_stat (char const *file_name, 
bool after_links)
        }

       delayed_set_stat_head = data->next;
-      xheader_xattr_free (data->xattr_map, data->xattr_map_size);
-      free (data->cntx_name);
-      free (data->acls_a_ptr);
-      free (data->acls_d_ptr);
-      free (data);
+      free_delayed_set_stat (data);
     }
 }

diff --git a/src/misc.c b/src/misc.c
index 8e66643..d263c07 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -586,7 +586,12 @@ safer_rmdir (const char *file_name)
       return -1;
     }

-  return unlinkat (chdir_fd, file_name, AT_REMOVEDIR);
+  if (unlinkat (chdir_fd, file_name, AT_REMOVEDIR) == 0)
+    {
+      remove_delayed_set_stat (file_name);
+      return 0;
+    }
+  return -1;
 }

 /* Remove FILE_NAME, returning 1 on success.  If FILE_NAME is a directory,

reply via email to

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