nils-werner / crestic

Configurable Restic Wrapper

Home Page:https://nils-werner.github.io/crestic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot restore paths with blanks

fdw opened this issue · comments

I tried to restore some files in a path with blanks, like this: crestic <profile> restore <snapshot> --include "/some/path/that has blanks". Unfortunately, the call to restic does not include quotation marks anymore, so it ends up like restic restore --repo <repo> --include /some/path/that has blanks <snapshot>. Obviously, restic cannot parse this.

Yes, this is definitely unwanted. Have a look at the run-noshell branch and see if it fixes it for you.

And can you please provide some example commands/unit tests that exhibit this behaviour?

Sorry, that branch doesn't look it's fixed :(

Regarding a unit test: It should be enough it to call crestic <profile> restore <snapshot> --include "path with blank" --target "something else " and check if the resulting call is restic restore --repo <repo> --include="path with blank" --target="something else" <snapshot> with the quotes.
Maybe I can write something sometime, I'll have to see.

I cannot recreate the spaces-issue, but rather an argument ordering issue, as reported in #14

You are right; this is fixed on the branch you mentioned.
I was confused because I also have to escape [] and because the dryrun output does not use quotation marks.

Are you then still interested in a unit test?

Can you confirm that

crestic <profile> restore --include "/some/path/that has blanks" <snapshot>

indeed worked? In that case I will close this issue and will soon document the argument ordering issue a bit more.

With version 0.5.0, it unfortunately does not work:

crestic <profile> restore --include "path/with blanks" --target . <snapshot> fails with unrecognized arguments: <snapshot>.
crestic <profile> restore <snapshot> --include "path/with blanks" --target . fails with more than one snapshot ID specified: [<blanks> <snapshot>]

Can you try the intermixed-args branch and see if it fixes your argument ordering issue? Note this feature requires Python 3.7

I think the argument ordering is fixed now; both variants give the same error message.

However, paths with blanks don't work on the intermixed-args branch.

I think the argument ordering is fixed now; both variants give the same error message.

I don't understand, is it fixed or does it give errors? :-D

However, paths with blanks don't work on the intermixed-args branch.

Yes, that's expected, I haven't merged the two branches yet

Sorry, I first tried the commands above with the spaces in the path.

I've just run it this branch with other snapshots, and indeed, the ordering does not matter anymore; both ways work. So thank you :)

Alright, I have merged the two changes into fix-restore, so it should work completely now... Can you please check? I will also use this version for a few days and, given there are no errors, will create a new release.

Yup, that branch works perfectly. Thank you :)