duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #02745
[Merge] lp:~aaron-whitehouse/duplicity/bug_932482_trailing_slashes_and_wildcards_error into lp:duplicity
Aaron Whitehouse has proposed merging lp:~aaron-whitehouse/duplicity/bug_932482_trailing_slashes_and_wildcards_error into lp:duplicity.
Requested reviews:
duplicity-team (duplicity-team)
Related bugs:
Bug #932482 in Duplicity: "Globbing exclude fails with trailing slash"
https://bugs.launchpad.net/duplicity/+bug/932482
For more details, see:
https://code.launchpad.net/~aaron-whitehouse/duplicity/bug_932482_trailing_slashes_and_wildcards_error/+merge/248193
Added functional and unit tests to show Bug #932482 - that selection does not work correctly when excludes (in a filelist or in a commandline option) contain both a single or double asterisk and a trailing slash.
--
Your team duplicity-team is requested to review the proposed merge of lp:~aaron-whitehouse/duplicity/bug_932482_trailing_slashes_and_wildcards_error into lp:duplicity.
=== modified file 'testing/functional/test_selection.py'
--- testing/functional/test_selection.py 2015-01-29 22:51:55 +0000
+++ testing/functional/test_selection.py 2015-01-31 16:20:45 +0000
@@ -727,5 +727,76 @@
"--exclude", "**/1/3"])
self.restore_and_check()
+class TestTrailingSlash(IncludeExcludeFunctionalTest):
+ """ Test to check that a trailing slash works as expected
+ Exhibits the issue reported in Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482)."""
+
+ def restore_and_check(self):
+ """Restores the backup and compares to what is expected."""
+ self.restore()
+ restore_dir = 'testfiles/restore_out'
+ restored = self.directory_tree_to_list_of_lists(restore_dir)
+ self.assertEqual(restored, [['2'], ['1']])
+
+ def test_exclude_globbing_filelist_trailing_slashes(self):
+ """test_exclude_globbing_filelist_asterisks_none with trailing slashes."""
+ with open("testfiles/filelist.txt", 'w') as f:
+ f.write("+ testfiles/select/1/2/1/\n"
+ "- testfiles/select/1/2/\n"
+ "- testfiles/select/1/1/\n"
+ "- testfiles/select/1/3/")
+ self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/filelist.txt"])
+ self.restore_and_check()
+
+ @unittest.expectedFailure
+ def test_exclude_globbing_filelist_trailing_slashes_single_wildcards_excludes(self):
+ """test_exclude_globbing_filelist_trailing_slashes with single wildcards in excludes."""
+ # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482)
+ with open("testfiles/filelist.txt", 'w') as f:
+ f.write("+ testfiles/select/1/2/1/\n"
+ "- */select/1/2/\n"
+ "- testfiles/*/1/1/\n"
+ "- */*/1/3/")
+ self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/filelist.txt"])
+ self.restore_and_check()
+
+ @unittest.expectedFailure
+ def test_exclude_globbing_filelist_trailing_slashes_double_wildcards_excludes(self):
+ """test_exclude_globbing_filelist_trailing_slashes with double wildcards in excludes."""
+ # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482)
+ with open("testfiles/filelist.txt", 'w') as f:
+ f.write("+ testfiles/select/1/2/1/\n"
+ "- **/1/2/\n"
+ "- **/1/1/\n"
+ "- **/1/3/")
+ self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/filelist.txt"])
+ self.restore_and_check()
+
+ @unittest.expectedFailure
+ def test_exclude_globbing_filelist_trailing_slashes_double_wildcards_excludes(self):
+ """test_exclude_globbing_filelist_trailing_slashes with double wildcards in excludes."""
+ # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482) and likely
+ # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
+ with open("testfiles/filelist.txt", 'w') as f:
+ f.write("+ **/1/2/1/\n"
+ "- **/1/2/\n"
+ "- **/1/1/\n"
+ "- **/1/3/")
+ self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/filelist.txt"])
+ self.restore_and_check()
+
+ @unittest.expectedFailure
+ def test_exclude_globbing_filelist_trailing_slashes_wildcards(self):
+ """test_commandline_asterisks_single_excludes_only with trailing slashes."""
+ # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482)
+ self.backup("full", "testfiles/select/1",
+ options=["--include", "testfiles/select/1/2/1/",
+ "--exclude", "testfiles/*/1/2/",
+ "--exclude", "*/select/1/1/",
+ "--exclude", "*/select/1/3/"])
+ self.restore_and_check()
+
+
+
if __name__ == "__main__":
unittest.main()
=== modified file 'testing/unit/test_selection.py'
--- testing/unit/test_selection.py 2015-01-29 23:15:50 +0000
+++ testing/unit/test_selection.py 2015-01-31 16:20:45 +0000
@@ -817,6 +817,40 @@
"- **/1\n"
"- **"])
+ def test_include_globbing_filelist_trailing_slashes(self):
+ """Filelist glob test similar to globbing filelist, but with trailing slashes"""
+ self.ParseTest([("--include-globbing-filelist", "file")],
+ [(), ('1',), ('1', '1'), ('1', '1', '2'),
+ ('1', '1', '3')],
+ ["- testfiles/select/1/1/1/\n"
+ "testfiles/select/1/1/\n"
+ "- testfiles/select/1/\n"
+ "- **"])
+
+ @unittest.expectedFailure
+ def test_include_globbing_filelist_trailing_slashes_and_single_asterisks(self):
+ """Filelist glob test similar to globbing filelist, but with trailing slashes and single asterisks"""
+ # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482)
+ self.ParseTest([("--include-globbing-filelist", "file")],
+ [(), ('1',), ('1', '1'), ('1', '1', '2'),
+ ('1', '1', '3')],
+ ["- */select/1/1/1/\n"
+ "testfiles/select/1/1/\n"
+ "- testfiles/*/1/\n"
+ "- **"])
+
+ @unittest.expectedFailure
+ def test_include_globbing_filelist_trailing_slashes_and_double_asterisks(self):
+ """Filelist glob test similar to globbing filelist, but with trailing slashes and double asterisks"""
+ # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482)
+ self.ParseTest([("--include-globbing-filelist", "file")],
+ [(), ('1',), ('1', '1'), ('1', '1', '2'),
+ ('1', '1', '3')],
+ ["- **/1/1/1/\n"
+ "testfiles/select/1/1/\n"
+ "- **/1/\n"
+ "- **"])
+
def test_exclude_globbing_filelist(self):
"""Exclude version of test_globbing_filelist"""
self.ParseTest([("--exclude-globbing-filelist", "file")],
Follow ups