From 093b229e22e58c58690b138c19fcfc3c268852c1 Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Sat, 21 Mar 2015 10:23:56 +0100 Subject: [PATCH] When printing protocol messages drop printing \n All protocol messages exchanged between the daemons already include an \n at the end so no need to print an extra one and as such create debug info that is much harder to parse. --- src/dird/restore.c | 4 ++-- src/dird/scheduler.c | 2 +- src/filed/backup.c | 12 ++++++------ src/stored/askdir.c | 6 +++--- src/stored/fd_cmds.c | 4 ++-- src/stored/job.c | 12 ++++++------ src/stored/read.c | 4 ++-- src/stored/sd_stats.c | 6 +++--- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/dird/restore.c b/src/dird/restore.c index 794b1e07c84..45005afd6d0 100644 --- a/src/dird/restore.c +++ b/src/dird/restore.c @@ -248,7 +248,7 @@ static inline bool do_native_restore_bootstrap(JCR *jcr) store->SDDport, tls_need, jcr->sd_auth_key); memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key)); - Dmsg1(6, "dird>filed: %s\n", fd->msg); + Dmsg1(6, "dird>filed: %s", fd->msg); if (!response(jcr, fd, OKstore, "Storage", DISPLAY_ERROR)) { goto bail_out; } @@ -262,7 +262,7 @@ static inline bool do_native_restore_bootstrap(JCR *jcr) fd->fsend(setauthorizationcmd, jcr->sd_auth_key); memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key)); - Dmsg1(6, "dird>filed: %s\n", fd->msg); + Dmsg1(6, "dird>filed: %s", fd->msg); if (!response(jcr, fd, OKAuthorization, "Setauthorization", DISPLAY_ERROR)) { goto bail_out; } diff --git a/src/dird/scheduler.c b/src/dird/scheduler.c index a886d5a1fa6..c34d5a42861 100644 --- a/src/dird/scheduler.c +++ b/src/dird/scheduler.c @@ -354,7 +354,7 @@ static void find_runs() nh_woy = tm_woy(next_hour); /* get week of year */ nh_yday = tm.tm_yday; /* get day of year */ - Dmsg8(dbglvl, "nh = %x: h=%d m=%d md=%d wd=%d wom=%d woy=%d yday=%d\n\n", + Dmsg8(dbglvl, "nh = %x: h=%d m=%d md=%d wd=%d wom=%d woy=%d yday=%d\n", next_hour, nh_hour, nh_month, nh_mday, nh_wday, nh_wom, nh_woy, nh_yday); nh_is_last_week = is_doy_in_last_week(tm.tm_year + 1900 , nh_yday); diff --git a/src/filed/backup.c b/src/filed/backup.c index 1e13cda2783..f8577e8e493 100644 --- a/src/filed/backup.c +++ b/src/filed/backup.c @@ -226,7 +226,7 @@ static inline bool save_rsrc_and_finder(b_save_ctx &bsctx) Dmsg1(300, "Saving Finder Info for \"%s\"\n", bsctx.ff_pkt->fname); sd->fsend("%ld %d 0", bsctx.jcr->JobFiles, STREAM_HFSPLUS_ATTRIBUTES); - Dmsg1(300, "filed>stored:header %s\n", sd->msg); + Dmsg1(300, "filed>stored:header %s", sd->msg); pm_memcpy(sd->msg, bsctx.ff_pkt->hfsinfo.fndrinfo, 32); sd->msglen = 32; if (bsctx.digest) { @@ -359,7 +359,7 @@ static inline bool terminate_signing_digest(b_save_ctx &bsctx) * Send our header */ sd->fsend("%ld %ld 0", bsctx.jcr->JobFiles, STREAM_SIGNED_DIGEST); - Dmsg1(300, "filed>stored:header %s\n", sd->msg); + Dmsg1(300, "filed>stored:header %s", sd->msg); /* * Encode signature data @@ -391,7 +391,7 @@ static inline bool terminate_digest(b_save_ctx &bsctx) BSOCK *sd = bsctx.jcr->store_bsock; sd->fsend("%ld %d 0", bsctx.jcr->JobFiles, bsctx.digest_stream); - Dmsg1(300, "filed>stored:header %s\n", sd->msg); + Dmsg1(300, "filed>stored:header %s", sd->msg); size = CRYPTO_DIGEST_MAX_SIZE; @@ -1167,7 +1167,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, } goto bail_out; } - Dmsg1(300, ">stored: datahdr %s\n", sd->msg); + Dmsg1(300, ">stored: datahdr %s", sd->msg); /* * Make space at beginning of buffer for fileAddr because this @@ -1334,7 +1334,7 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) } return false; } - Dmsg1(300, ">stored: attrhdr %s\n", sd->msg); + Dmsg1(300, ">stored: attrhdr %s", sd->msg); /** * Send file attributes to Storage daemon @@ -1438,7 +1438,7 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) unstrip_path(ff_pkt); } - Dmsg2(300, ">stored: attr len=%d: %s\n", sd->msglen, sd->msg); + Dmsg2(300, ">stored: attr len=%d: %s", sd->msglen, sd->msg); if (!status && !jcr->is_job_canceled()) { Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), sd->bstrerror()); } diff --git a/src/stored/askdir.c b/src/stored/askdir.c index 86cfcdfd9b5..4f4c377e5ac 100644 --- a/src/stored/askdir.c +++ b/src/stored/askdir.c @@ -109,7 +109,7 @@ bool SD_DCR::dir_update_device(JCR *jcr, DEVICE *dev) dev->is_tape()?100000:1, dev->autoselect, 0, ChangerName.c_str(), MediaType.c_str(), VolumeName.c_str()); - Dmsg1(dbglvl, ">dird: %s\n", dir->msg); + Dmsg1(dbglvl, ">dird: %s", dir->msg); return ok; } @@ -138,7 +138,7 @@ bool SD_DCR::dir_update_changer(JCR *jcr, AUTOCHANGER *changer) "*", /* ChangerName */ MediaType.c_str(), /* MediaType */ "*"); /* VolName */ - Dmsg1(dbglvl, ">dird: %s\n", dir->msg); + Dmsg1(dbglvl, ">dird: %s", dir->msg); return ok; } #endif @@ -483,7 +483,7 @@ bool SD_DCR::dir_update_file_attributes(DEV_RECORD *record) ser_uint32(record->data_len); ser_bytes(record->data, record->data_len); dir->msglen = ser_length(dir->msg); - Dmsg1(1800, ">dird %s\n", dir->msg); /* Attributes */ + Dmsg1(1800, ">dird %s", dir->msg); /* Attributes */ return dir->send(); } diff --git a/src/stored/fd_cmds.c b/src/stored/fd_cmds.c index 68ef62f7205..f368bfd6c06 100644 --- a/src/stored/fd_cmds.c +++ b/src/stored/fd_cmds.c @@ -244,7 +244,7 @@ void do_fd_commands(JCR *jcr) if (!found) { /* command not found */ if (!job_canceled(jcr)) { Jmsg1(jcr, M_FATAL, 0, _("FD command not found: %s\n"), fd->msg); - Dmsg1(110, "msg); + Dmsg1(110, "msg); } fd->fsend(ferrmsg); break; @@ -427,7 +427,7 @@ static bool read_close_session(JCR *jcr) * Send final close msg to File daemon */ fd->fsend(OK_close, jcr->JobStatus); - Dmsg1(160, ">filed: %s\n", fd->msg); + Dmsg1(160, ">filed: %s", fd->msg); fd->signal(BNET_EOD); /* send EOD to File daemon */ diff --git a/src/stored/job.c b/src/stored/job.c index a78a15cf3ca..90aaf749d20 100644 --- a/src/stored/job.c +++ b/src/stored/job.c @@ -323,7 +323,7 @@ bool nextrun_cmd(JCR *jcr) */ return true; default: - Dmsg1(200, "Nextrun_cmd: %s\n", jcr->dir_bsock->msg); + Dmsg1(200, "Nextrun_cmd: %s", jcr->dir_bsock->msg); Jmsg2(jcr, M_FATAL, 0, _("Hey!!!! JobId %u Job %s tries to use nextrun cmd while not part of protocol.\n"), (uint32_t)jcr->JobId, jcr->Job); return false; @@ -341,7 +341,7 @@ bool finish_cmd(JCR *jcr) */ switch (jcr->getJobProtocol()) { case PT_NDMP: - Dmsg1(200, "Finish_cmd: %s\n", jcr->dir_bsock->msg); + Dmsg1(200, "Finish_cmd: %s", jcr->dir_bsock->msg); jcr->end_time = time(NULL); dequeue_messages(jcr); /* send any queued messages */ @@ -370,7 +370,7 @@ bool finish_cmd(JCR *jcr) return false; /* Continue DIR session ? */ default: - Dmsg1(200, "Finish_cmd: %s\n", jcr->dir_bsock->msg); + Dmsg1(200, "Finish_cmd: %s", jcr->dir_bsock->msg); Jmsg2(jcr, M_FATAL, 0, _("Hey!!!! JobId %u Job %s tries to use finish cmd while not part of protocol.\n"), (uint32_t)jcr->JobId, jcr->Job); return false; /* Continue DIR session ? */ @@ -396,7 +396,7 @@ bool query_cmd(JCR *jcr) Dmsg1(100, "Query_cmd: %s", dir->msg); ok = sscanf(dir->msg, query_device, dev_name.c_str()) == 1; - Dmsg1(100, "msg); + Dmsg1(100, "msg); if (ok) { unbash_spaces(dev_name); foreach_res(device, R_DEVICE) { @@ -436,12 +436,12 @@ bool query_cmd(JCR *jcr) unbash_spaces(dir->msg); pm_strcpy(jcr->errmsg, dir->msg); dir->fsend(NO_device, dev_name.c_str()); - Dmsg1(100, ">dird: %s\n", dir->msg); + Dmsg1(100, ">dird: %s", dir->msg); } else { unbash_spaces(dir->msg); pm_strcpy(jcr->errmsg, dir->msg); dir->fsend(BAD_query, jcr->errmsg); - Dmsg1(100, ">dird: %s\n", dir->msg); + Dmsg1(100, ">dird: %s", dir->msg); } return true; diff --git a/src/stored/read.c b/src/stored/read.c index 8c5f5f746d9..7c025e0d196 100644 --- a/src/stored/read.c +++ b/src/stored/read.c @@ -132,12 +132,12 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) */ if (!fd->fsend(rec_header, rec->VolSessionId, rec->VolSessionTime, rec->FileIndex, rec->Stream, rec->data_len)) { - Pmsg1(000, _(">filed: Error Hdr=%s\n"), fd->msg); + Pmsg1(000, _(">filed: Error Hdr=%s"), fd->msg); Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"), fd->bstrerror()); return false; } else { - Dmsg1(400, ">filed: Hdr=%s\n", fd->msg); + Dmsg1(400, ">filed: Hdr=%s", fd->msg); } /* diff --git a/src/stored/sd_stats.c b/src/stored/sd_stats.c index 0e8be3d3bea..5b25f633790 100644 --- a/src/stored/sd_stats.c +++ b/src/stored/sd_stats.c @@ -490,7 +490,7 @@ bool stats_cmd(JCR *jcr) dev_stat->DevWriteTime, dev_stat->MediaId, dev_stat->VolCatBytes, dev_stat->VolCatFiles, dev_stat->VolCatBlocks); - Dmsg1(100, ">dird: %s\n", msg.c_str()); + Dmsg1(100, ">dird: %s", msg.c_str()); dir->fsend(msg.c_str()); } @@ -520,7 +520,7 @@ bool stats_cmd(JCR *jcr) pm_strcpy(dev_tmp, dev_stats->DevName); bash_spaces(dev_tmp); Mmsg(msg, TapeAlerts, tape_alert->timestamp, dev_tmp.c_str(), tape_alert->flags); - Dmsg1(100, ">dird: %s\n", msg.c_str()); + Dmsg1(100, ">dird: %s", msg.c_str()); dir->fsend(msg.c_str()); next_tape_alert = (struct device_tapealert *)dev_stats->tapealerts->next(tape_alert); @@ -555,7 +555,7 @@ bool stats_cmd(JCR *jcr) bash_spaces(dev_tmp); Mmsg(msg, JobStats, job_stat->timestamp, job_stats->JobId, job_stat->JobFiles, job_stat->JobBytes, dev_tmp.c_str()); - Dmsg1(100, ">dird: %s\n", msg.c_str()); + Dmsg1(100, ">dird: %s", msg.c_str()); dir->fsend(msg.c_str()); }