14539: Tests that '\056' cannot be used as a file or directory name.
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Mon, 17 Dec 2018 23:35:31 +0000 (20:35 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Fri, 21 Dec 2018 21:59:44 +0000 (18:59 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

build/run-tests.sh
sdk/python/tests/test_collections.py

index cd44347cbabed54d1d19dc8373383160fde7dc1a..50c578269d007bfa3c4e4533bd57e0c3318ac166 100755 (executable)
@@ -37,7 +37,7 @@ CONFIGSRC=path Dir with api server config files to copy into source tree.
                (If none given, leave config files alone in source tree.)
 services/api_test="TEST=test/functional/arvados/v1/collections_controller_test.rb"
                Restrict apiserver tests to the given file
-sdk/python_test="--test-suite test.test_keep_locator"
+sdk/python_test="--test-suite tests.test_keep_locator"
                Restrict Python SDK tests to the given class
 apps/workbench_test="TEST=test/integration/pipeline_instances_test.rb"
                Restrict Workbench tests to the given file
index b5c0c1c524968322779c9663bbd0e1c1c3ff2162..55dd0838f253f0b9bf97703eee6c472568e73893 100644 (file)
@@ -957,6 +957,18 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         c.remove("foo/count2.txt")
         self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo d41d8cd98f00b204e9800998ecf8427e+0 0:0:\\056\n", c.portable_manifest_text())
 
+    def test_create_dot_file(self):
+        c = Collection()
+        with self.assertRaises(IOError):
+            with c.open("./dir/\\056", "wb") as f:
+                f.write("Should not be allowed")
+
+    def test_create_file_inside_dot_dir(self):
+        c = Collection()
+        with self.assertRaises(IOError):
+            with c.open("./dir/\\056/foo", "wb") as f:
+                f.write("Should not be allowed")
+
     def test_remove_empty_subdir(self):
         c = Collection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 781e5e245d69b566979b86e28d23f2c7+10 0:10:count2.txt\n')
         c.remove("foo/count2.txt")