Commit a1f0a7b8 authored by owsla's avatar owsla

Final fixes to trailing spaces support


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@963 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent ae7b721d
......@@ -89,17 +89,15 @@ def quote(path):
and not Globals.must_escape_trailing_spaces:
return QuotedPath
if Globals.must_escape_dos_devices:
assert Globals.must_escape_trailing_spaces
# Escape a trailing space or period (invalid in names on FAT32 under DOS,
# Windows and modern Linux)
if len(QuotedPath) and (QuotedPath[-1] == ' ' or QuotedPath[-1] == '.'):
QuotedPath = QuotedPath[:-1] + \
if Globals.must_escape_trailing_spaces:
if len(QuotedPath) and (QuotedPath[-1] == ' ' or QuotedPath[-1] == '.'):
QuotedPath = QuotedPath[:-1] + \
"%s%03d" % (quoting_char, ord(QuotedPath[-1]))
if not Globals.must_escape_dos_devices:
return QuotedPath
if not Globals.must_escape_dos_devices:
return QuotedPath
# Escape first char of any special DOS device files even if filename has an
# extension. Special names are: aux, prn, con, nul, com0-9, and lpt1-9.
......
......@@ -586,7 +586,7 @@ class FSAbilities:
log.Log("escape_trailing_spaces required by filesystem at %s" \
% (subdir.path), 4)
self.escape_trailing_spaces = 1
except(OSError):
except (OSError, IOError):
log.Log("escape_trailing_spaces required by filesystem at %s" \
% (subdir.path), 4)
self.escape_trailing_spaces = 1
......@@ -707,7 +707,8 @@ class BackupSetGlobals(SetGlobals):
space_rp.delete()
else:
local_ets = 1
except (OSError): local_ets = 1
except (OSError, IOError):
local_ets = 1
SetConnections.UpdateGlobal('must_escape_trailing_spaces', \
self.src_fsa.escape_trailing_spaces or local_ets)
log.Log("Backup: must_escape_trailing_spaces = %d" % \
......@@ -839,7 +840,8 @@ class RestoreSetGlobals(SetGlobals):
space_rp.delete()
else:
local_ets = 1
except (OSError): local_ets = 1
except (OSError, IOError):
local_ets = 1
SetConnections.UpdateGlobal('must_escape_trailing_spaces', \
src_ets or local_ets)
log.Log("Restore: must_escape_trailing_spaces = %d" % \
......
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