Mercurial > hg
diff hgext/win32mbcs.py @ 32207:176ed32dc159 stable
win32mbcs: wrap underlying pycompat.bytestr to use checkwinfilename safely
win32mbcs wraps some functions, to prevent them from unintentionally
treating backslash (0x5c), which is used as the second or later byte
of multi bytes characters by problematic encodings, as a path
component delimiter on Windows platform.
This wrapping assumes that wrapped functions can safely accept unicode
string arguments.
Unfortunately, d1937bdcee8c broke this assumption by introducing
pycompat.bytestr() into util.checkwinfilename() for py3 support. After
that, wrapped checkwinfilename() always fails for non-ASCII filename
at pycompat.bytestr() invocation.
This patch wraps underlying pycompat.bytestr() function to use
util.checkwinfilename() safely.
To avoid similar regression in the future, another patch series will
add smoke testing on default branch.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 12 May 2017 21:46:14 +0900 |
parents | e995f00a9e9a |
children | 3a755652ce3a 377c74ef008d |
line wrap: on
line diff
--- a/hgext/win32mbcs.py Tue May 09 15:08:47 2017 +0200 +++ b/hgext/win32mbcs.py Fri May 12 21:46:14 2017 +0900 @@ -155,7 +155,8 @@ # These functions are required to be called with local encoded string # because they expects argument is local encoded string and cause # problem with unicode string. -rfuncs = '''mercurial.encoding.upper mercurial.encoding.lower''' +rfuncs = '''mercurial.encoding.upper mercurial.encoding.lower + mercurial.pycompat.bytestr''' # List of Windows specific functions to be wrapped. winfuncs = '''os.path.splitunc'''