]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #9682: give a name instead of a number for stream that are unexpected
authorAlain Spineux <alain@baculasystems.com>
Mon, 28 Nov 2022 11:29:04 +0000 (12:29 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:00 +0000 (13:57 +0200)
- notice that I have changed "Unknown" into "Unexpected"
- I also use asciidump() to dump the raw data inDmsg() instead of just a %s

bextract JobId 0: Error: Unknown stream=20 ignored. This shouldn't happen!
become
bextract JobId 0: Error: Unexpected stream="Encrypted File data" ignored. This shouldn't happen!

bacula/src/filed/restore.c
bacula/src/stored/bextract.c
bacula/src/stored/bscan.c

index e5258c981a21225cc88f4e9822e169bc0dfc4933..0f5c2ca512a08b747eb5d85b1d4647b88e720021 100644 (file)
@@ -257,6 +257,7 @@ static inline bool pop_delayed_data_streams(r_ctx &rctx)
 {
    RESTORE_DATA_STREAM *rds;
    JCR *jcr = rctx.jcr;
+   char buf[80]; /* for asciidump() */
 
    /*
     * See if there is anything todo.
@@ -325,9 +326,10 @@ static inline bool pop_delayed_data_streams(r_ctx &rctx)
          }
          break;
       default:
-         Jmsg(jcr, M_WARNING, 0, _("Unknown stream=%d ignored. This shouldn't happen!\n"),
-              rds->stream);
-         Dmsg2(50, "Unknown stream=%d data=%s\n", rds->stream, rds->content);
+         Jmsg(jcr, M_WARNING, 0, _("Unexpected stream \"%s\" ignored. This shouldn't happen!\n"),
+               stream_to_ascii(rds->stream));
+         Dmsg2(50, "Unexpected stream=%d data=%s...\n", rds->stream,
+               asciidump(rds->content, rds->content_length, buf, sizeof(buf)));
          break;
       }
       if (rds->content) {
@@ -360,6 +362,7 @@ void do_restore(JCR *jcr)
    r_ctx rctx;
    ATTR *attr;
    int bget_ret = 0;
+   char buf[80];                       /* for asciidump() */
    /* ***FIXME*** make configurable */
    crypto_digest_t signing_algorithm = have_sha2 ?
                                        CRYPTO_DIGEST_SHA256 : CRYPTO_DIGEST_SHA1;
@@ -1104,9 +1107,10 @@ void do_restore(JCR *jcr)
          if (!close_previous_stream(rctx)) {
             goto get_out;
          }
-         Jmsg(jcr, M_WARNING, 0, _("Unknown stream=%d ignored. This shouldn't happen!\n"),
-              rctx.stream);
-         Dmsg2(50, "Unknown stream=%d data=%s\n", rctx.stream, bmsg->rbuf);
+         Jmsg(jcr, M_WARNING, 0, _("Unexpected stream=\"%s\" ignored. This shouldn't happen!\n"),
+               stream_to_ascii(rctx.stream));
+         Dmsg2(50, "Unexpected stream=%d data=%s\n", rctx.stream,
+               asciidump(bmsg->rbuf, bmsg->rbuflen, buf, sizeof(buf)));
          break;
       } /* end switch(stream) */
 
index c91f6f7252e788fd9e99df0695421504be39e606..c44423de980ace4f692cc8076d4b81b4f65d0a5a 100644 (file)
@@ -754,8 +754,8 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
          set_attributes(jcr, attr, &bfd);
          extract = false;
       }
-      Jmsg(jcr, M_ERROR, 0, _("Unknown stream=%d ignored. This shouldn't happen!\n"),
-         rec->Stream);
+      Jmsg(jcr, M_ERROR, 0, _("Unexpected stream=\"%s\" ignored. This shouldn't happen!\n"),
+            stream_to_ascii(rec->Stream));
       break;
 
    } /* end switch */
index 5ee839bada9fbed78acd696c9fdb9eec13660614..98f7cb8300c85f1fc5383c6598fe92ae6e0ca7c4 100644 (file)
@@ -1065,7 +1065,8 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
       break;
 
    default:
-      Pmsg2(0, _("Unknown stream type!!! stream=%d len=%i\n"), rec->Stream, rec->data_len);
+      Pmsg2(0, _("Unexpected stream type!!! stream=\"%s\" len=%i\n"),
+            stream_to_ascii(rec->Stream), rec->data_len);
       break;
    }
    free_jcr(mjcr);                 /* got from get_jcr_by_session() above */