Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backing up files with spaces in them with --files-from argument #1590

Closed
mdemoulin opened this issue Jan 26, 2018 · 5 comments · Fixed by #1613
Closed

backing up files with spaces in them with --files-from argument #1590

mdemoulin opened this issue Jan 26, 2018 · 5 comments · Fixed by #1613

Comments

@mdemoulin
Copy link

Output of restic version

restic 0.8.1
compiled with go1.9.2 on linux/amd64

How did you run restic exactly?

/usr/local/lib/restic_0.8.1_linux_amd64 backup --password-file=/usr/local/etc/chbackup/private/chbackup-passwd --repo=b2:xxx --files-from=/usr/local/etc/chbackup/dirs.conf --exclude-file=/usr/local/etc/chbackup/exceptions.conf --hostname=xxx --tag=system

What backend/server/service did you use to store the repository?

B2, but I don't think it matters

Expected behavior

I would like to be able to back up files and directories with spaces in the name

Actual behavior

/'a\ b' does not exist, skipping
/a\ b does not exist, skipping
/'a b' does not exist, skipping

Steps to reproduce the behavior

Just have a directory with a space in the name in a file referenced by the files-from argument. I tried

Do you have any idea what may have caused this?

Do you have an idea how to solve the issue?

I tried various quoting methods with no joy

Did restic help you or made you happy in any way?

I do love restic, but do need to be able to back up such files

@underhillian
Copy link

I ran a very simple test case to a local repo where I attempted to back up a single directory with an embedded space, specifically:

/home/testrestic/test dir

Placing various quoted variations of this directory in my --files-from file failed just as it did in your example. However, including the line exactly as written above (space and all) succeeded. From this test, it appears that quoting of spaces is not required.

This seems odd (not at all what I would have expected), but since it worked in my simple test case, you might want to give it a try and report back.

@mdemoulin
Copy link
Author

Thanks. I did try this, and then went to trying out various quoting options when it did not work. I took another look upon getting your reply, and it turns out I had a space at the end of that line (referenced by --files-from). Live by the not quoting, die by the not quoting, I suppose

Thanks again

@fd0
Copy link
Member

fd0 commented Feb 10, 2018

That's an interesting failure case. For --files-from, restic takes each line as a literal file/dirname, without unquoting or stripping any spaces.

@underhillian
Copy link

FWIW, the required syntax for "--files-from" files and "--exclude-file" files appears to be different.

"--files-from" entries work as described above. "--exclude-files" entries appear to require quoted special characters (blanks in particular).

I'm only now trying to learn to read Go (I'm a slow learner!) so not clear to me why this is.

@fd0
Copy link
Member

fd0 commented Feb 11, 2018

FWIW, the required syntax for "--files-from" files and "--exclude-file" files appears to be different.

Oh, good point, that's an issue. For --exclude-file, spaces are stripped at the start and end of each line, and I'll open a PR which also will do that for --files-from.

fd0 added a commit that referenced this issue Feb 11, 2018
In #1590, it was mentioned that while lines read from exclude files via
`--exclude-file` have leading and trailing spaces stripped, this is not
the case for lines read via `--files-from`. This commit fixes that,
spaces are always stripped.
@fd0 fd0 reopened this Feb 11, 2018
@fd0 fd0 closed this as completed in #1613 Feb 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants