View Issue Details

IDProjectCategoryView StatusLast Update
0000505bareos-corebatpublic2015-10-02 19:59
Reportermvwieringen Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformOpenIndianaOSOpenIndianaOS Versionb151a
Product Version15.2.0 
Summary0000505: BAT hangs on Jobs tab
DescriptionBAT hangs on Jobs tab due to changed API mode 1 output of .defaults.
Additional InformationDue to the changes for API mode 2 (JSON) it seems the output of the .defaults
command changed something that BAT doesn't like.
TagsNo tags attached.

Relationships

child of 0000501 closedmaik Release bareos-15.2.1 

Activities

joergs

joergs

2015-08-16 23:13

developer  

0001-fix.patch (3,764 bytes)   
From 73ee10117d97c2b3c56db1c0efa1e7d8c0d59e19 Mon Sep 17 00:00:00 2001
From: Joerg Steffens <joerg.steffens@bareos.com>
Date: Sun, 16 Aug 2015 23:12:37 +0200
Subject: [PATCH] fix

---
 src/dird/ua_dotcmds.c              | 11 +++++++++++
 src/lib/output_formatter.h         |  2 +-
 src/qt-console/console/console.cpp |  2 ++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/dird/ua_dotcmds.c b/src/dird/ua_dotcmds.c
index 1b97da7..a10f2b5 100644
--- a/src/dird/ua_dotcmds.c
+++ b/src/dird/ua_dotcmds.c
@@ -1406,27 +1406,38 @@ static bool defaultscmd(UAContext *ua, const char *cmd)
 
          ua->send->object_key_value("job", "%s=", job->name(), "%s");
          ua->send->decoration("\n");
+         ua->send->process_text_buffer();
          ua->send->object_key_value("pool", "%s=", job->pool->name(), "%s");
          ua->send->decoration("\n");
+         ua->send->process_text_buffer();
          ua->send->object_key_value("messages", "%s=", job->messages->name(), "%s");
          ua->send->decoration("\n");
+         ua->send->process_text_buffer();
          ua->send->object_key_value("client", "%s=", ((job->client) ? job->client->name() : _("*None*")), "%s");
          ua->send->decoration("\n");
+         ua->send->process_text_buffer();
          get_job_storage(&store, job, NULL);
          ua->send->object_key_value("storage", "%s=", store.store->name(), "%s");
          ua->send->decoration("\n");
+         ua->send->process_text_buffer();
          ua->send->object_key_value("where", "%s=", (job->RestoreWhere ? job->RestoreWhere : ""), "%s");
          ua->send->decoration("\n");
+         ua->send->process_text_buffer();
          ua->send->object_key_value("level", "%s=", level_to_str(job->JobLevel), "%s");
          ua->send->decoration("\n");
+         ua->send->process_text_buffer();
          ua->send->object_key_value("type", "%s=", job_type_to_str(job->JobType), "%s");
          ua->send->decoration("\n");
+         ua->send->process_text_buffer();
          ua->send->object_key_value("fileset", "%s=", ((job->fileset) ? job->fileset->name() : _("*None*")), "%s");
          ua->send->decoration("\n");
+         ua->send->process_text_buffer();
          ua->send->object_key_value("enabled", "%s=", job->enabled, "%d");
          ua->send->decoration("\n");
+         ua->send->process_text_buffer();
          ua->send->object_key_value("catalog", "%s=", ((job->client) ? job->client->catalog->name() : _("*None*")), "%s");
          ua->send->decoration("\n");
+         ua->send->process_text_buffer();
       }
    } else if ((pos = find_arg_with_value(ua, "client")) >= 0) {
       CLIENTRES *client;
diff --git a/src/lib/output_formatter.h b/src/lib/output_formatter.h
index abee93a..ae10e40 100644
--- a/src/lib/output_formatter.h
+++ b/src/lib/output_formatter.h
@@ -70,6 +70,7 @@ public:
 
    void message(const char *type, POOL_MEM &message);
 
+   void process_text_buffer();
    void finalize_result(bool result);
 
 #if HAVE_JANSSON
@@ -96,7 +97,6 @@ private:
     */
    void rewrap(POOL_MEM &string, int wrap);
 
-   void process_text_buffer();
 
 #if HAVE_JANSSON
    json_t *result_json;
diff --git a/src/qt-console/console/console.cpp b/src/qt-console/console/console.cpp
index b357402..8b0ea6f 100644
--- a/src/qt-console/console/console.cpp
+++ b/src/qt-console/console/console.cpp
@@ -435,6 +435,8 @@ bool Console::get_job_defaults(int &conn, struct job_defaults &job_defs, bool do
       *def++ = 0;
       strip_trailing_newline(def);
 
+      Pmsg2(000, "job_defaults: key=%s, value=%s\n", dircomm->msg(), def);
+
       if (strcmp(dircomm->msg(), "job") == 0) {
          if (strcmp(def, job_defs.job_name.toUtf8().data()) != 0) {
             goto bail_out;
-- 
1.9.1

0001-fix.patch (3,764 bytes)   
joergs

joergs

2015-08-16 23:21

developer   ~0001804

On my systen, bat does not hang, but also does not show the jobs information. It only displays an empty table with as many rows than defined jobs.

The attached patch fixes the problem in this case.

In this case, BAT expects each key/value pair as seperate message without further seperators.

Currently, the only way to handle this is to make the internal OUTPUT_FORMATTER::process_text_buffer function public and call it after each key/value pair.

Adding a seperator and parse this would lead to incompabilities with older versions.

If I don't find a better approach, I will apply this change also at the other places of the code.
mvwieringen

mvwieringen

2015-08-18 23:00

developer   ~0001805

Fix committed to bareos master branch with changesetid 5507.

Related Changesets

bareos: master 1dbed65a

2015-08-17 01:12

joergs


Committer: mvwieringen

Ported: N/A

Details Diff
.default job: send each line as seperate message

The job tab in BAT calls "defaults job" in API mode 1.
It parses the result message by message, instead of looking for a
seperator.
This patch adds the OUTPUT_FORMATTER:send_buffer() function.
When called, it sends the current buffer as a seperate message.
Currently it is only used for the ".defaults job" command.

Fixes 0000505: BAT hangs on Jobs tab
Affected Issues
0000505
mod - src/dird/ua_dotcmds.c Diff File
mod - src/lib/output_formatter.c Diff File
mod - src/lib/output_formatter.h Diff File
mod - src/qt-console/console/console.cpp Diff File

Issue History

Date Modified Username Field Change
2015-08-15 08:53 mvwieringen New Issue
2015-08-15 08:53 mvwieringen Status new => assigned
2015-08-15 08:53 mvwieringen Assigned To => joergs
2015-08-15 08:54 mvwieringen Relationship added child of 0000501
2015-08-16 23:13 joergs File Added: 0001-fix.patch
2015-08-16 23:21 joergs Note Added: 0001804
2015-08-18 23:00 mvwieringen Changeset attached => bareos master 1dbed65a
2015-08-18 23:00 mvwieringen Note Added: 0001805
2015-08-18 23:00 mvwieringen Status assigned => resolved
2015-08-18 23:00 mvwieringen Resolution open => fixed
2015-10-02 19:59 mvwieringen adm Assigned To joergs =>
2015-10-02 19:59 mvwieringen adm Status resolved => closed