summaryrefslogtreecommitdiff
path: root/rdiff-backup/testing/FilenameMappingtest.py
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-11-05 02:56:21 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-11-05 02:56:21 +0000
commit75a6e8910e22b4588a0856e8907d7e6be30ed616 (patch)
treeb769f26079d2f138a8017db2c6ec8ddfd661aad7 /rdiff-backup/testing/FilenameMappingtest.py
parentc8e580986d8b6bbce80586dfdfaa319ac1322884 (diff)
downloadrdiff-backup-75a6e8910e22b4588a0856e8907d7e6be30ed616.tar.gz
quoted filename too long fix
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r1-0@671 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing/FilenameMappingtest.py')
-rw-r--r--rdiff-backup/testing/FilenameMappingtest.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/rdiff-backup/testing/FilenameMappingtest.py b/rdiff-backup/testing/FilenameMappingtest.py
index e364c59..1bc1b6c 100644
--- a/rdiff-backup/testing/FilenameMappingtest.py
+++ b/rdiff-backup/testing/FilenameMappingtest.py
@@ -1,6 +1,6 @@
import unittest
from commontest import *
-from rdiff_backup import FilenameMapping
+from rdiff_backup import FilenameMapping, rpath, Globals
class FilenameMappingTest(unittest.TestCase):
"""Test the FilenameMapping class, for quoting filenames"""
@@ -29,4 +29,31 @@ class FilenameMappingTest(unittest.TestCase):
assert (qrp.index[0] ==
"mirror_metadata.1969-12-31T21:33:20-07:00.data.gz")
+ def testLongFilenames(self):
+ """See if long quoted filenames cause crash"""
+ MakeOutputDir()
+ outrp = rpath.RPath(Globals.local_connection, "testfiles/output")
+ inrp = rpath.RPath(Globals.local_connection, "testfiles/quotetest")
+ re_init_dir(inrp)
+ long_filename = "A"*200 # when quoted should cause overflow
+ longrp = inrp.append(long_filename)
+ longrp.touch()
+ shortrp = inrp.append("B")
+ shortrp.touch()
+
+ rdiff_backup(1, 1, inrp.path, outrp.path, 100000,
+ extra_options = "--override-chars-to-quote A")
+
+ longrp_out = outrp.append(long_filename)
+ assert not longrp_out.lstat()
+ shortrp_out = outrp.append('B')
+ assert shortrp_out.lstat()
+
+ rdiff_backup(1, 1, "testfiles/empty", outrp.path, 200000)
+ shortrp_out.setdata()
+ assert not shortrp_out.lstat()
+ rdiff_backup(1, 1, inrp.path, outrp.path, 300000)
+ shortrp_out.setdata()
+ assert shortrp_out.lstat()
+
if __name__ == "__main__": unittest.main()