Package: duplicity
Version: 0.7.07.1-1
Severity: normal
Tags: patch

Dear Maintainer,

trying to backup files with upoper case letters fails when using
"ignorecase".
Example:

# duplicity --exclude "ignorecase:**/.cache/**" --no-encryption
/var/log/
file:///tmp/test

Last full backup date: none
No signatures found, switching to full backup.
Error listing directory /var/log/consolekit
Error [Errno 2] No such file or directory: '/var/log/xorg.0.log'
getting delta
for Xorg.0.log
Error [Errno 2] No such file or directory: '/var/log/xorg.0.log.old'
getting
delta for Xorg.0.log.old
Error [Errno 2] No such file or directory: '/var/log/xorg.1.log'
getting delta
for Xorg.1.log
Error [Errno 2] No such file or directory: '/var/log/xorg.1.log.old'
getting
delta for Xorg.1.log.old



The attached patch fixes the issue for me.


Hope this makes sense.

Regards

Malte
--- duplicity/globmatch.py.orig	2016-03-07 22:46:51.000000000 +0100
+++ duplicity/globmatch.py	2016-06-02 16:46:03.360517692 +0200
@@ -49,7 +49,7 @@
     return list(map(glob_to_regex, prefixes))
 
 
-def path_matches_glob(path, glob_str, include):
+def path_matches_glob(path, glob_str, include, ignore_case = False):
     """Tests whether path matches glob, as per the Unix shell rules, taking as
     arguments a path, a glob string and include (0 indicating that the glob
     string is an exclude glob and 1 indicating that it is an include glob,
@@ -68,7 +68,11 @@
         # string)
         glob_str = glob_str[:-1]
 
-    re_comp = lambda r: re.compile(r, re.S)
+    flags = 0
+    if ignore_case:
+        flags = re.IGNORECASE
+
+    re_comp = lambda r: re.compile(r, re.S | flags)
 
     # matches what glob matches and any files in directory
     glob_comp_re = re_comp("^%s($|/)" % glob_to_regex(glob_str))
--- duplicity/selection.py.orig	2016-03-07 22:46:51.000000000 +0100
+++ duplicity/selection.py	2016-06-02 16:46:36.641761484 +0200
@@ -545,9 +545,7 @@
             raise FilePrefixError(glob_str)
 
         def sel_func(path):
-            if ignore_case:
-                path.name = path.name.lower()
-            return path_matches_glob(path, glob_str, include)
+            return path_matches_glob(path, glob_str, include, ignore_case)
 
         return sel_func
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to