Globbing patterns with trailing slashes should only match directories
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Duplicity |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Ubuntu 14.04
Duplicity is 0.7.x, checked out 10 minutes ago from Bazaar via "bzr branch lp:duplicity".
Initially I thought that this "bug" is related to https:/
In some version of duplicity trailing slash processing has been broken, but is very important. Previously (many years ago probably) one could write in an excluding file something like:
+ /var/log/**/
- /var/log/**
That means "include the whole directory skeleton in the backup, but DO NOT include actual files with data". It was extremely handy: in many cases the directory structure is important (e.g. for /var/log: if you restore a machine from a full backup and do not have /var/log/apache2 directory, Apache will fail to load after the restoration).
So, trailing / means "hey, I mean directory, not a file!", and that was the only method to distinct directories and files in duplicity. So I would be very happy if plain old days return, and we can include directory skeletons to backups again.
Now this doesn't work, it's very easy to reproduce - just add the above lines to your exclude-
Related branches
- duplicity-team: Pending requested
-
Diff: 218 lines (+103/-20)4 files modifiedduplicity/selection.py (+33/-7)
po/duplicity.pot (+1/-1)
testing/functional/test_selection.py (+51/-0)
testing/unit/test_selection.py (+18/-12)
description: | updated |
summary: |
- "Include the directory skeleton, but exclude all files with data" does - not work anymore + Trailing slashes: "Include the directory skeleton, but exclude all files + with data" does not work anymore |
Changed in duplicity: | |
importance: | Undecided → Medium |
milestone: | none → 0.7.04 |
status: | New → Fix Committed |
Changed in duplicity: | |
status: | Fix Committed → Fix Released |
While the particular use case that you have proposed (including a directory skeleton without files) seems fairly niche to me, I note that the behaviour that you have proposed appears to be how glob.glob's expansion works: /docs.python. org/3.5/ library/ glob.html /hg.python. org/cpython/ file/3. 5/Lib/glob. py (see line 39)
https:/
https:/
and I would be quite keen to keep the behaviour of duplicity consistent with that.
It isn't directly on point, but it is worth reading this mailing list thread on the behaviour of single and double asterisks: lists.nongnu. org/archive/ html/duplicity- talk/2015- 03/msg00017. html
http://
Presumably fixing this would also allow for the use case of including the files in a directory, but not any subfolders:
- /some/path/*/
+ /some/path/*
which I'm not sure is currently possible.
Given that trailing slashes have been broken until my recent fix, now seems like the time to implement this, as there shouldn't be any risk of breaking existing behaviour.
Ken, are you happy for me to go ahead and try to implement this, or would you like a wider discussion on the mailing list about it first?