Radosław Korzeniewski wrote on 1/23/23 9:27 AM:
You should share what you have changed to be able to confirm if your changes 
caused the issue.
Yes, sure... I found this old patch code from CVS that only restores the 
attributes of data, since we had a chmod-mishap: 
bacula/patches/testing/project-restore-attributes-only.patch.

The additions to baconfig.h and dird/dird_conf.c were pretty basic.  But the code for 
filed/restore.c has been updated so much, maybe I put the code in a wrong place?  I put it here and 
changed "extract" to "rctx.extract" so it was consistent with the rest of the 
code:

                /*
                 * Do not count the resource forks as regular files being 
restored.
                 */
                if (rsrc_len == 0) {
                   jcr->JobFiles++;
                }
             } else {
                jcr->JobFiles++;
             }

+            if (jcr->replace == REPLACE_ATTR_ALWAYS   ||
+                jcr->replace == REPLACE_ATTR_IFEXISTS)
+            {
+               rctx.extract = false;        /* we just want attributes */
+            }

             if (!rctx.extract) {
                /*
                 * set attributes now because file will not be extracted
                 */
                if (jcr->plugin) {
                   plugin_set_attributes(jcr, attr, &rctx.bfd);

findlib/create_file.c seemed pretty straight forward too:

       case REPLACE_NEVER:
          /* Set attributes if we created this directory */
          if (attr->type == FT_DIREND && path_list_lookup(jcr, attr->ofname)) {
             break;
          }
          Qmsg(jcr, M_SKIPPED, 0, _("File skipped. Already exists: %s\n"), 
attr->ofname);
          return CF_SKIP;
+ case REPLACE_ATTR_ALWAYS:
+         return CF_CREATED;

       case REPLACE_ALWAYS:
          break;
       }
+    } else { /* File doesn't exists anymore */
+       if (replace == REPLACE_ATTR_IFEXISTS) {
+          Qmsg(jcr, M_SKIPPED, 0, _("File skipped. Doesn't exists anymore: 
%s\n"), attr->ofname);
+          return CF_SKIP;
+       }
    }
    switch (attr->type) {
    case FT_RAW:                       /* raw device to be written */


We know why it is crashing (as explained above), but the root cause of why it 
ended up in this situation is unknown. You have a dozen possibilities including 
your changes.
That's about 10 or 11 more than I can think of!  Hopefully the code above helps 
narrow it down.

Many thanks


_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to