Commit e73f5576 authored by owsla's avatar owsla

First pass at fixing escape DOS devices and trailing spaces/periods.


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@991 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 507c7be3
New in v1.2.5 (????/??/??)
---------------------------
Fix escape DOS devices and escape trailing spaces/periods. (Andrew Ferguson)
New in v1.2.4 (2009/01/01) New in v1.2.4 (2009/01/01)
--------------------------- ---------------------------
......
...@@ -85,18 +85,17 @@ def quote(path): ...@@ -85,18 +85,17 @@ def quote(path):
""" """
QuotedPath = chars_to_quote_regexp.sub(quote_single, path) QuotedPath = chars_to_quote_regexp.sub(quote_single, path)
if not Globals.must_escape_dos_devices \ if not Globals.escape_dos_devices and not Globals.escape_trailing_spaces:
and not Globals.must_escape_trailing_spaces:
return QuotedPath return QuotedPath
# Escape a trailing space or period (invalid in names on FAT32 under DOS, # Escape a trailing space or period (invalid in names on FAT32 under DOS,
# Windows and modern Linux) # Windows and modern Linux)
if Globals.must_escape_trailing_spaces: if Globals.escape_trailing_spaces:
if len(QuotedPath) and (QuotedPath[-1] == ' ' or QuotedPath[-1] == '.'): if len(QuotedPath) and (QuotedPath[-1] == ' ' or QuotedPath[-1] == '.'):
QuotedPath = QuotedPath[:-1] + \ QuotedPath = QuotedPath[:-1] + \
"%s%03d" % (quoting_char, ord(QuotedPath[-1])) "%s%03d" % (quoting_char, ord(QuotedPath[-1]))
if not Globals.must_escape_dos_devices: if not Globals.escape_dos_devices:
return QuotedPath return QuotedPath
# Escape first char of any special DOS device files even if filename has an # Escape first char of any special DOS device files even if filename has an
......
...@@ -860,7 +860,8 @@ def checkdest_need_check(dest_rp): ...@@ -860,7 +860,8 @@ def checkdest_need_check(dest_rp):
"""Return None if no dest dir found, 1 if dest dir needs check, 0 o/w""" """Return None if no dest dir found, 1 if dest dir needs check, 0 o/w"""
if not dest_rp.isdir() or not Globals.rbdir.isdir(): return None if not dest_rp.isdir() or not Globals.rbdir.isdir(): return None
for filename in Globals.rbdir.listdir(): for filename in Globals.rbdir.listdir():
if filename not in ['chars_to_quote', 'backup.log']: break if filename not in ['chars_to_quote', 'special_escapes',
'backup.log']: break
else: # This may happen the first backup just after we test for quoting else: # This may happen the first backup just after we test for quoting
return None return None
curmirroot = Globals.rbdir.append("current_mirror") curmirroot = Globals.rbdir.append("current_mirror")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment