bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] One-file-system and listed-incremental again


From: Sergey Poznyakoff
Subject: Re: [Bug-tar] One-file-system and listed-incremental again
Date: Thu, 01 Dec 2005 16:48:50 EET

Hi,

Peter Kronheimer <address@hidden> wrote:

> I am aware of the new behaviour of "--one-file-system" and --extract
> in 1.15: this version of tar will not purge directories on a
> "different" file system. However, the question is "different from
> what?"
> 
> Am I right in thinking that "different" means "different from the cwd
> in which tar is invoked"?

Yes, you are right.

> The result
> is that the above restore script fails to purge stuff that should be
> purged: everything that is restored by the script above is on the
> "different" device at /mnt/new.
> Is this the intended behaviour?

No, it is not. It was intended that --one-file-system would tak into
account -C options. The following patch fixes it:

Index: src/extract.c
===================================================================
RCS file: /cvsroot/tar/tar/src/extract.c,v
retrieving revision 1.85
diff -p -u -r1.85 extract.c
--- src/extract.c       1 Dec 2005 12:50:58 -0000       1.85
+++ src/extract.c       1 Dec 2005 14:46:15 -0000
@@ -120,19 +120,6 @@ extr_init (void)
   same_permissions_option += we_are_root;
   same_owner_option += we_are_root;
 
-  /* Save 'root device' to avoid purging mount points.
-     FIXME: Should the same be done after handling -C option ? */
-  if (one_file_system_option)
-    {
-      struct stat st;
-      char *dir = xgetcwd ();
-
-      if (deref_stat (true, dir, &st))
-       stat_diag (dir);
-      else
-       root_device = st.st_dev;
-    }
-
   /* Option -p clears the kernel umask, so it does not affect proper
      restoration of file permissions.  New intermediate directories will
      comply with umask at start of program.  */
@@ -625,6 +612,19 @@ extract_dir (char *file_name, int typefl
   int status;
   mode_t mode;
   int interdir_made = 0;
+
+  /* Save 'root device' to avoid purging mount points. */
+  if (one_file_system_option && root_device == 0)
+    {
+      struct stat st;
+      char *dir = xgetcwd ();
+
+      if (deref_stat (true, dir, &st))
+       stat_diag (dir);
+      else
+       root_device = st.st_dev;
+      free (dir);
+    }
 
   if (incremental_option)
     /* Read the entry and delete files that aren't listed in the archive.  */

Regards,
Sergey
     




reply via email to

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