#2173 PR merged: bacula: Fixed 'bconsole' prompt not displaying at all when doing a recover

Labels: bug, fixed / solved / done

rmetrich opened issue at 2019-07-04 08:13:

Relax-and-Recover (ReaR) Pull Request Template

Please fill in the following items before submitting a new pull request:

Pull Request Details:
  • Type: Bug Fix

  • Impact: Normal

  • Reference to related issue (URL):

  • How was this pull request tested? Tested a recovery with bacula until bconsole is executed

  • Brief description of the changes in this pull request:

With this change, the bconsole output is sent to FD 7, which is stdout. Previously the output was sent to FD 1 which is redirected to the ReaR log.

rmetrich commented at 2019-07-04 08:21:

Expected prompt:

Press ENTER to start bconsole

Connecting to Director XXX:9101
1000 OK: bacula-dir Version: 5.2.13 (19 February 2013)
Enter a period to cancel a command.
*

Without the fix:

Press ENTER to start bconsole

jsmeix commented at 2019-07-04 08:39:

@rmetrich
I don't know how bconsole behaves but in general according to
the sections "What to do with stdin, stdout, and stderr"
and "It should be possible to run ReaR unattended" in
https://github.com/rear/rear/wiki/Coding-Style
I would run all commands that (possibly) do user dialogs
(i.e. all [possibly] interactive commands)
with the original stdin, stdout, and stderr file descriptors
when usr/sbin/rear was launched like

COMMAND ... 0<&6 1>&7 2>&8

gdha commented at 2019-07-04 08:39:

@rmetrich I assigned the PR to you as I assume that it is linked to a RH case?

rmetrich commented at 2019-07-04 08:43:

@rmetrich
I don't know how bconsole behaves but in general according to
the sections "What to do with stdin, stdout, and stderr"
and "It should be possible to run ReaR unattended" in
https://github.com/rear/rear/wiki/Coding-Style
I would run all commands that (possibly) do user dialogs
(i.e. all [possibly] interactive commands)
with the original stdin, stdout, and stderr file descriptors
when usr/sbin/rear was launched like

COMMAND ... 0<&6 1>&7 2>&8

Seems even more robust, thanks!

rmetrich commented at 2019-07-04 08:49:

@rmetrich I assigned the PR to you as I assume that it is linked to a RH case?

Yes, this is https://bugzilla.redhat.com/show_bug.cgi?id=1726992

jsmeix commented at 2019-07-04 08:56:

@rmetrich
as it seems you can run bconsole and see how it actually behaves:
What about adding a Log message to have something about it
in ReaR's log file like

if bconsole 0<&6 1>&7 2>&8 ; then
    Log "bconsole finished with zero exit code"
else
    Log "bconsole finished with non-zero exit code $?"
fi

to make it easier to see what happened when someone
(e.g. we at ReaR upstream) must analyze a ReaR issue
only with what there is in the ReaR log file.

pcahyna commented at 2019-08-22 17:16:

I suspect that BAREOS will need the same fix: https://github.com/rmetrich/rear/blob/161e35a541bcdc46b50e00edb4b5d5e0b527a321/usr/share/rear/restore/BAREOS/default/400_restore_backup.sh#L154


[Export of Github issue for rear/rear.]