#2382 PR merged: Improve borg integration into rear

Labels: enhancement, fixed / solved / done

flyinggreenfrog opened issue at 2020-04-30 02:25:

Relax-and-Recover (ReaR) Pull Request Details:

  • Type: Enhancement

  • Impact: Normal

  • Reference to related issue (URL): No explicit issue.

  • How was this pull request tested? openSUSE Leap 15.1 Baremetal via USB rescue medium

  • Brief description of the changes in this pull request:

I worked on several improvements (e.g. error handling, output to logfile etc. in regard to use Borg with rear).

Since this is my first attempt in contributing to rear, I tried following http://relax-and-recover.org/development/ the same as https://github.com/rear/rear/wiki/Coding-Style.

Since I could only test my changes for my openSUSE Leap 15.1 setup and I'm not sure how you test new changes in rear to not break anything, I'm aware that this PR may not be accepted as is.

Please have a look at my commits nevertheless, and I'm happy to get feedback.

gozora commented at 2020-04-30 07:12:

Hello @flyinggreenfrog,

Many thanks for you work, it looks good for me at least at the first sight ;-).
I'd like however to take some time and do some additional testing before it will be merged.

If I understand it well from plain looking, this patch will enable Borg to be used with USB ?
If so, could you please add your use case to doc and examples ?

@jsmeix @gdha can you tell me how much time remains before ReaR 2.6 will be released?

V.

gozora commented at 2020-04-30 07:18:

Hello @jsmeix,

Could you please review code responsible for IO redirection 0<&6 1>&7 2>&8, 0<&6 1>&7 2> >(tee >(cat 1>&2) >&8) and friends, because, frankly, I have only little clue how this works inside ReaR ;-).

Thanks

V.

jsmeix commented at 2020-04-30 08:14:

@gozora
regarding 0<&6 1>&7 2>&8 see the section
"What to do with stdin, stdout, and stderr" in
https://github.com/rear/rear/wiki/Coding-Style

The 0<&6 1>&7 2> >(tee >(cat 1>&2) >&8) is something
that I am currently trying to decipher...

flyinggreenfrog commented at 2020-04-30 08:31:

@gozora
regarding 0<&6 1>&7 2>&8 see the section
"What to do with stdin, stdout, and stderr" in
https://github.com/rear/rear/wiki/Coding-Style

The 0<&6 1>&7 2> >(tee >(cat 1>&2) >&8) is something
that I am currently trying to decipher...

Maybe the commit messages from https://github.com/flyinggreenfrog/rear/commit/0838cd8c9b30a4a2473de4d4f8b74565c8a553f8 and https://github.com/flyinggreenfrog/rear/commit/53d876d054d0e8eb6bd8c1af81c620d1418ced1a explain my intentions? If not, I'll try to explain more.

flyinggreenfrog commented at 2020-04-30 08:33:

Hello @flyinggreenfrog,

Many thanks for you work, it looks good for me at least at the first sight ;-).
I'd like however to take some time and do some additional testing before it will be merged.

If I understand it well from plain looking, this patch will enable Borg to be used with USB ?
If so, could you please add your use case to doc and examples ?

@jsmeix @gdha can you tell me how much time remains before ReaR 2.6 will be released?

V.

This patch is not specific to USB, but I was only testing it with OUTPUT=USB. It should work the same with other outputs.

flyinggreenfrog commented at 2020-04-30 08:35:

@gozora
regarding 0<&6 1>&7 2>&8 see the section
"What to do with stdin, stdout, and stderr" in
https://github.com/rear/rear/wiki/Coding-Style
The 0<&6 1>&7 2> >(tee >(cat 1>&2) >&8) is something
that I am currently trying to decipher...

Maybe the commit messages from flyinggreenfrog@0838cd8 and flyinggreenfrog@53d876d explain my intentions? If not, I'll try to explain more.

Generally I want to "copy" stderr from Borg in some cases, that this output can go to the logfile and to stderr (for the user to see while create, prune or extract the backup). Does that make sense to you?

I tried to follow https://stackoverflow.com/a/45798436.

flyinggreenfrog commented at 2020-04-30 08:45:

@jsmeix @gdha can you tell me how much time remains before ReaR 2.6 will be released?

Yes, I challenged myself yesterday to create this PR, that maybe it still can make it to the new version ;-)

But of course enough testing has to be done before, that it doesn't break anything.

jsmeix commented at 2020-04-30 08:59:

@flyinggreenfrog
thank you for your explanation
https://github.com/flyinggreenfrog/rear/commit/0838cd8c9b30a4a2473de4d4f8b74565c8a553f8
in
https://github.com/rear/rear/pull/2382#issuecomment-621695346

Please provide such explanations for complicated code parts
as comments directly in the bash scripts because in practice
git commit messages are lost (i.e. not easily accessible)
when someone else (another user) looks at the code in a script
at any time later because the user may not have a git checkout
but only the plain script when he is using (not developing) ReaR.

gozora commented at 2020-04-30 09:24:

@flyinggreenfrog

This patch is not specific to USB, but I was only testing it with OUTPUT=USB. It should work the same with other outputs.

Could you please send me your configuration file(s) (local.conf, site.conf)? I'd love see config you've tested with.

V.

gozora commented at 2020-04-30 09:26:

@flyinggreenfrog

Yes, I challenged myself yesterday to create this PR, that maybe it still can make it to the new version ;-)

But of course enough testing has to be done before, that it doesn't break anything.

I'll do my best to finish review as soon as I can ...

V.

jsmeix commented at 2020-04-30 09:33:

@gozora
see https://github.com/rear/rear/milestones
regarding due date for ReaR 2.6

ReaR v2.6
Due by May 30, 2020

so no need to hurry right now.
Next week is still perfectly fine.

gozora commented at 2020-04-30 09:45:

@jsmeix

Cool! That looks like enough time ...

V.

gozora commented at 2020-04-30 10:12:

@flyinggreenfrog

This patch is not specific to USB, but I was only testing it with OUTPUT=USB. It should work the same with other outputs.

Could you please send me your configuration file(s) (local.conf, site.conf)? I'd love see config you've tested with.

Please ignore this message of mine.
Despite I actually wrote the code, I've totally forgotten that ReaR (on Borg back end) works with USB already :-)
I'm getting old ...

V.

flyinggreenfrog commented at 2020-05-01 07:29:

I tried to work on all your comments.

Moreover I added several other commits to this PR especially for working on code quality checks with shellcheck (https://www.shellcheck.net).

Hopefully you can also please review them, thanks.

gozora commented at 2020-05-01 07:53:

Hello @flyinggreenfrog,
Will check today evening. Thaks for now!

V.

flyinggreenfrog commented at 2020-05-05 06:12:

Hello together.

Since I was sick the last days, I will try to work on the outstanding remarks in the evening. Sorry for delay.

jsmeix commented at 2020-05-05 06:31:

@flyinggreenfrog
thank you for your notification.
No rush - take your time!
I promise the world will not end at ReaR 2.6 release date ;-)
I can promise that because if I was wrong nobody could blame me ;-)

gozora commented at 2020-05-10 17:22:

@flyinggreenfrog thanks for your contribution, it is appreciated!

V.


[Export of Github issue for rear/rear.]