bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] savedir() error handling


From: Jean-Louis Martineau
Subject: Re: [Bug-tar] savedir() error handling
Date: Mon, 31 Aug 2009 16:45:33 -0400
User-agent: Thunderbird 2.0.0.23 (X11/20090825)

I sent a patch a few days for the same problem. But my user user was not able to test it.
The patch call savedir only if needed.

If you can give it a try.

Jean-Louis


Solar Designer wrote:
Sergey,

On Tue, Aug 25, 2009 at 10:37:13AM +0300, Sergey Poznyakoff wrote:
Solar Designer <address@hidden> ha escrit:
  char *dirp = savedir (dir);   /* for scanning directory */
[...]
  if (! dirp)
    savedir_error (dir);

Perhaps we need to patch this in our usual way?
Looks reasonable. I'll see what can be done.

I just had this occur (TAREXIT_FAILURE on a removed deep directory) on a
system that was already running 1.22.90-owl1, confirming that it is
indeed still affected.

Are you going to propose a patch for this, or should I?

tar: ./home/clients/websites/w_client/drupal/5.10/cache/example.org/0/group: 
Cannot savedir: No such file or directory
tar: ./home/clients/websites/w_client/drupal/5.10/cache/example.org/0/group: 
Directory removed before we read it
tar: ./home/clients/websites/w_client/drupal/5.10/cache/example.org/0/solution: 
Cannot savedir: No such file or directory
tar: ./home/clients/websites/w_client/drupal/5.10/cache/example.org/0/solution: 
Directory removed before we read it
tar: ./home/clients/websites/w_client/drupal/5.10/cache/example.org/0/group: 
File removed before we read it
tar: 
./home/clients/websites/w_client/drupal/5.10/cache/example.org/0/blog.html: 
File removed before we read it
[...]
tar: 
./home/clients/websites/w_client/drupal/5.10/cache/example.org/0/node/3111.html:
 File removed before we read it
tar: Exiting with failure status due to previous errors

Thanks,

Alexander



diff --git a/src/incremen.c b/src/incremen.c
index bb2ba2f..6da029a 100644
--- a/src/incremen.c
+++ b/src/incremen.c
@@ -691,7 +691,7 @@ makedumpdir (struct directory *directory, const char *dir)
 struct directory *
 scan_directory (char *dir, dev_t device, bool cmdline)
 {
-  char *dirp = savedir (dir);  /* for scanning directory */
+  char *dirp = NULL;           /* for scanning directory */
   char *name_buffer;           /* directory, `/', and directory member */
   size_t name_buffer_size;     /* allocated size of name_buffer, minus 2 */
   size_t name_length;          /* used length in name_buffer */
@@ -699,8 +699,6 @@ scan_directory (char *dir, dev_t device, bool cmdline)
   struct directory *directory;
   char ch;
   
-  if (! dirp)
-    savedir_error (dir);
 
   name_buffer_size = strlen (dir) + NAME_FIELD_SIZE;
   name_buffer = xmalloc (name_buffer_size + 2);
@@ -714,7 +712,6 @@ scan_directory (char *dir, dev_t device, bool cmdline)
            children = CHANGED_CHILDREN;
         but changed to: */
       free (name_buffer);
-      free (dirp);
       return NULL;
     }
 
@@ -730,6 +727,13 @@ scan_directory (char *dir, dev_t device, bool cmdline)
       name_buffer[++name_length] = 0;
     }
 
+  if (directory->children != NO_CHILDREN)
+    {
+      dirp = savedir (dir);
+      if (! dirp)
+        savedir_error (dir);
+    }
+
   if (dirp && directory->children != NO_CHILDREN)
     {
       char *entry;     /* directory entry being scanned */

reply via email to

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