]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #10365 Pass comment field to copy/migration jobs from the control job
authorEric Bollengier <eric@baculasystems.com>
Wed, 30 Aug 2023 09:40:45 +0000 (11:40 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 13 Feb 2024 09:36:03 +0000 (10:36 +0100)
bacula/src/dird/mac.c

index a4a317b9946edf4cc9bdd845f60a4589c70b3328..bc2eaaaf1b454a9a949da9ca64a7cbe88278b52b 100644 (file)
@@ -187,6 +187,11 @@ bool do_mac_init(JCR *jcr)
    wjcr = new_jcr(sizeof(JCR), dird_free_jcr);
    memcpy(&wjcr->previous_jr, &jcr->previous_jr, sizeof(wjcr->previous_jr));
 
+   /* Adjust the Comment field from the control job */
+   if (jcr->comment[0]) {
+      pm_strcpy(wjcr->comment, jcr->comment);
+   }
+
    /*
     * Turn the wjcr into a "real" job that takes on the aspects of
     *   the previous backup job "prev_job".
@@ -764,6 +769,13 @@ void start_mac_job(JCR *jcr)
    Mmsg(ua->cmd, "run job=\"%s\" jobid=%s ignoreduplicatecheck=yes pool=\"%s\"",
         jcr->job->name(), edit_uint64(jcr->MigrateJobId, ed1),
         jcr->pool->name());
+
+   if (is_comment_legal(NULL, jcr->comment)) {
+      pm_strcat(ua->cmd, " comment=\"");
+      pm_strcat(ua->cmd, jcr->comment);
+      pm_strcat(ua->cmd, "\"");
+   }
+
    if (jcr->next_pool) {
       bsnprintf(args, sizeof(args), " nextpool=\"%s\"", jcr->next_pool->name());
       pm_strcat(ua->cmd, args);