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

Re: [Bacula-devel] bacula ACL restore errors when replace=never


Hi,

On Tuesday 26 August 2008, Bastian Friedrich wrote:
>
> On Monday 25 August 2008, Kern Sibbald wrote:
> > This sounds like a bug to me and probably should be reported in the bugs
> > database. That said, it would be good to try to isolate what is going on
> > here as much as possible because we currently don't have much spare time,
> > which means that if you can pinpoint the problem we can probably fix it
> > quickly, but if we need reproduce the problem and research what is going
> > wrong, it will need to wait a bit.
>
[...]
>
> As I said, I was not able to track the problem down in a sensible way; for
> files not overwritten, probably there should be some "if (!extract) break;"
> lines in some (all?) of the stream examination chunks

this basically is the solution for the problem, in fact. I am attaching a 
patch that fixes most of the problems described in my original posting (and 
in the bug ticket).

I still have a problem, though:

When creating directories, the internal "extract" flag always is false, 
independently of whether the directory was in fact created, or whether it did 
already exist. The "makepath" function in findlib does not return information 
about whether it created any paths. Due to this, we can only _always_ or 
_never_ set directory ACLs during restore. I chose "always", but that means 
that "replace=never" restores overwrite already existing ACLs.

I am not 100% sure about other constraints of directory ACLs; there still may 
be issues.

The patch is restricted to ACLs; other stream types as restored in restore.c 
probably have similar concerns, but I did not check that.

Feel free to use the patch; you have my signed FLA.

Thx & best regards
   Bastian

-- 
Collax GmbH . Burkheimer Straße 3 . 79111 Freiburg . Germany
p: +49 (0) 761-45684-24
f: +49 (0) 761-45684-10        www.collax.com

Geschäftsführer: William K. Hite / Boris Nalbach
AG München HRB 158898 . Ust.-IdNr: DE 814464942
\ "Mr. Worf, scan that ship." "Aye Captain. 300 dpi?"
--- bacula-2.5-20080825svn/src/filed/restore.c.ori	2008-09-10 12:31:34.000000000 +0200
+++ bacula-2.5-20080825svn/src/filed/restore.c	2008-09-10 14:48:23.000000000 +0200
@@ -368,6 +368,8 @@
          switch (stat) {
          case CF_ERROR:
          case CF_SKIP:
+            pm_strcpy(jcr->last_fname, attr->ofname);
+            jcr->last_type = attr->type;
             break;
          case CF_EXTRACT:        /* File created and we expect file data */
             extract = true;
@@ -599,6 +601,14 @@
          break;
 
       case STREAM_UNIX_ACCESS_ACL:
+	 /*
+	  * Do not restore ACLs when
+	  * a) The current file is not extracted
+	  * b) and it is not a directory (they are never "extracted")
+	  * c) and file name is non-empty
+	  */
+	 if (!extract && jcr->last_type != FT_DIREND && (*jcr->last_fname != 0)) break;
+
          if (have_acl) {
             pm_strcpy(jcr->acl_text, sd->msg);
             Dmsg2(400, "Restoring ACL type 0x%2x <%s>\n", BACL_TYPE_ACCESS, jcr->acl_text);
@@ -611,6 +621,8 @@
          break;
 
       case STREAM_UNIX_DEFAULT_ACL:
+	 if (!extract && jcr->last_type != FT_DIREND && (*jcr->last_fname != 0)) break;
+
          if (have_acl) {
             pm_strcpy(jcr->acl_text, sd->msg);
             Dmsg2(400, "Restoring ACL type 0x%2x <%s>\n", BACL_TYPE_DEFAULT, jcr->acl_text);
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-devel mailing list
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilotco.