[elbe-devel] [PATCH v2 4/9] tests efilesystem: Add deeplinks test for copy_filelist

Olivier Dion dion at linutronix.de
Mon May 4 20:00:07 CEST 2020


From: Torben Hohn <torben.hohn at linutronix.de>

/bin -> usr/bin is located at the root level. This works with the
current implementation in copy_filelist(). But when a link is relative
and deeper in the directory hierarchy, things break.

Add a test for this case.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/tests/test_efilesystem.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/elbepack/tests/test_efilesystem.py b/elbepack/tests/test_efilesystem.py
index cdf713ca..54b014fc 100644
--- a/elbepack/tests/test_efilesystem.py
+++ b/elbepack/tests/test_efilesystem.py
@@ -43,3 +43,20 @@ class TestCopyFilelist(unittest.TestCase):
         # /DST/usr/bin/bla
         self.assertEqual(self.src.read_file('/usr/bin/bla'),
                          self.dst.read_file('/usr/bin/bla'))
+
+    def test_deeplinks(self):
+
+        self.src.mkdir_p('/a/b/c')
+
+        # c <- /a/b/d
+        self.src.symlink('c', '/a/b/d')
+
+        # This write into /a/b/c/bla (c instead of d)
+        self.src.write_file('/a/b/d/bla', 0o644, 'bla')
+
+        copy_filelist(self.src, ['/a/b/d/bla'], self.dst)
+
+        # We should now have the same content from /SRC/a/b/c/bla in
+        # /DST/a/b/c/bla
+        self.assertEqual(self.src.read_file('/a/b/c//bla'),
+                         self.dst.read_file('/a/b/c/bla'))
-- 
2.26.2




More information about the elbe-devel mailing list