gilbertchen / duplicacy

A new generation cloud backup tool
https://duplicacy.com
Other
5.24k stars 338 forks source link

Snapshot IDs with a / in the name fail to be cached locally #80

Open mjbshaw opened 7 years ago

mjbshaw commented 7 years ago

I created a duplicacy repo using the name foo/bar (e.g. duplicacy init -encrypt foo/bar <redacted_url>). I was able to backup successfully. But after backing up, I wanted to verify the backup, so I ran duplicacy check. That resulted in the following errors:

$ duplicacy check
Storage set to <redacted_url>
Listing all chunks
Failed to create the snapshot cache directory snapshots/foo/bar/: mkdir /<redacted_path>/.duplicacy/cache/default/snapshots/foo/bar: no such file or directory
Failed to add the file snapshots/foo/bar/1 to the snapshot cache: open /<redacted_path>/.duplicacy/cache/default/snapshots/foo/bar/1.nqhldvpf.tmp: no such file or directory
All chunks referenced by snapshot foo/bar at revision 1 exist

I think duplicacy should solve this by doing one of the three possible solutions I've thought of:

  1. Reject problematic snapshot IDs (so no snapshot ID can contain a problematic character, including problematic file names like NUL).
  2. Convert the UTF-8 snapshot ID into hex (or base-64, or whatever) and use that for the pathname in the local cache.
  3. Use mkdir -p (this only works around the / problem; other characters might be a problem).
gilbertchen commented 7 years ago

I added the following rule to the User Guide:

A snapshot id must contain only characters valid in Linux and Windows paths (alphabet, digits, underscore, dash, etc), but cannot include /, \, or @.