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

Leading spaces in 'quote' cause backup to fail #50

Open
jwittkoski opened this issue Jul 13, 2020 · 1 comment
Open

Leading spaces in 'quote' cause backup to fail #50

jwittkoski opened this issue Jul 13, 2020 · 1 comment

Comments

@jwittkoski
Copy link

jwittkoski commented Jul 13, 2020

In my b2.yaml file, I had my storage defined (during testing) as:

storage:
    -   name: "b2"
        threads: 5
        quote: " -dry-run"

When running this with debug on, it fails with:

... <snip> ...
22:57:01 Beginning backup on 07-12-2020 22:57:01
22:57:01 Backing up to storage b2 with 5 threads  -dry-run
22:57:01 Executing: /usr/local/bin/duplicacy[backup -storage b2 -stats -threads 5  -dry-run]
Error executing command: exit status 3
Error: Backup failed. Check the logs for details

The log file isn't much help:

22:57:01 Beginning backup on 07-12-2020 22:57:01
22:57:01 ######################################################################
22:57:01 Backing up to storage b2 with 5 threads  -dry-run
22:57:01 Executing: /usr/local/bin/duplicacy[backup -storage b2 -stats -threads 5  -dry-run]
22:57:01 The backup command requires no arguments.
22:57:01 
22:57:01 NAME:
22:57:01    duplicacy backup - Save a snapshot of the repository to the storage
22:57:01 
22:57:01 USAGE:
22:57:01    duplicacy backup [command options]  
22:57:01 
22:57:01 OPTIONS:
22:57:01    -hash 			detect file differences by hash (rather than size and timestamp)
22:57:01    -t <tag> 			assign a tag to the backup
22:57:01    -stats 			show statistics during and after backup
22:57:01    -threads <n>			number of uploading threads
22:57:01    -limit-rate <kB/s>		the maximum upload rate (in kilobytes/sec)
22:57:01    -dry-run 			dry run for testing, don't backup anything. Use with -stats and -d
22:57:01    -vss 			enable the Volume Shadow Copy service (Windows and macOS using APFS only)
22:57:01    -vss-timeout <timeout>	the timeout in seconds to wait for the Volume Shadow Copy operation to complete
22:57:01    -storage <storage name> 	backup to the specified storage instead of the default one
22:57:01    -enum-only 			enumerate the repository recursively and then exit
22:57:01    
22:57:01 Error executing command: exit status 3

After some experimentation, it turns out that the leading space in the quote option is causing this failure.

@jwittkoski jwittkoski changed the title Leading paces in 'quote' cause backup to fail Leading spaces in 'quote' cause backup to fail Jul 13, 2020
@jwittkoski
Copy link
Author

jwittkoski commented Jul 13, 2020

It's actually any leading, trailing, or multiple sequential spaces.

All of these fail:

" -dry-run"
"-dry-run "
"-dry-run   -hash"

It looks like this is due to how the code splits on spaces and turns them into command arguments for duplicacy (see https://github.com/jeffaco/duplicacy-util/blob/master/backup-ops.go#L203).

The empty "arguments" between the extra spaces are passed to duplicacy which sees the "empty" command arguments and then complains that the backup command doesn't require any arguments.

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

No branches or pull requests

1 participant