comparison 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
comparison
equal deleted inserted replaced
32206:5bdceec6387d 32207:176ed32dc159
153 mercurial.util.split''' 153 mercurial.util.split'''
154 154
155 # These functions are required to be called with local encoded string 155 # These functions are required to be called with local encoded string
156 # because they expects argument is local encoded string and cause 156 # because they expects argument is local encoded string and cause
157 # problem with unicode string. 157 # problem with unicode string.
158 rfuncs = '''mercurial.encoding.upper mercurial.encoding.lower''' 158 rfuncs = '''mercurial.encoding.upper mercurial.encoding.lower
159 mercurial.pycompat.bytestr'''
159 160
160 # List of Windows specific functions to be wrapped. 161 # List of Windows specific functions to be wrapped.
161 winfuncs = '''os.path.splitunc''' 162 winfuncs = '''os.path.splitunc'''
162 163
163 # codec and alias names of sjis and big5 to be faked. 164 # codec and alias names of sjis and big5 to be faked.