`bzr diff --using C:\foo\bar` does not work
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Medium
|
Gordon Tyler |
Bug Description
`diff --using` uses shlex.split to handle filename of diff tool, but shlex.split works bad with backslashes. See
In [1]: import shlex
In [2]: shlex.split(r'foo C:/bar/spam')
Out[2]: ['foo', 'C:/bar/spam']
In [3]: shlex.split(r'foo C:\bar\spam')
Out[3]: ['foo', 'C:barspam']
In [5]: shlex.split(r'foo C:\\bar\\spam')
Out[5]: ['foo', 'C:\\bar\\spam']
In [6]: shlex.split(r'foo "C:\bar\spam"')
Out[6]: ['foo', 'C:\\bar\\spam']
`diff --using` uses helper function in commands.py shlex_split_
Because even in the case of
bzr diff --using "C:\foo\bar"
this function will be invoked with unquoted argument, then there is always will be problem for windows users.
To solve this problem properly bzr should use Win32 API CommandLineToAr
This function is already using in win32utils:
Related problems: https:/
Related branches
- Martin Packman (community): Abstain
- John A Meinel: Needs Fixing
- Alexander Belchenko: Pending requested
-
Diff: 480 lines (+207/-124)5 files modifiedbzrlib/commands.py (+7/-2)
bzrlib/tests/test_commands.py (+1/-1)
bzrlib/tests/test_diff.py (+13/-1)
bzrlib/tests/test_win32utils.py (+38/-14)
bzrlib/win32utils.py (+148/-106)
- Martin Pool: Approve
-
Diff: 638 lines (+287/-187)9 files modifiedbzrlib/cmdline.py (+160/-0)
bzrlib/commands.py (+2/-6)
bzrlib/diff.py (+2/-2)
bzrlib/rules.py (+2/-3)
bzrlib/tests/test_cmdline.py (+74/-0)
bzrlib/tests/test_commands.py (+1/-1)
bzrlib/tests/test_diff.py (+13/-1)
bzrlib/tests/test_win32utils.py (+11/-60)
bzrlib/win32utils.py (+22/-114)
Changed in bzr: | |
assignee: | nobody → Alexander Belchenko (bialix) |
status: | New → Confirmed |
Changed in bzr: | |
assignee: | Alexander Belchenko (bialix) → nobody |
Changed in bzr: | |
importance: | Undecided → Medium |
tags: | added: win32 |
Changed in bzr: | |
assignee: | nobody → Gordon Tyler (doxxx) |
milestone: | none → 2.1.0rc1 |
Changed in bzr: | |
milestone: | 2.1.0rc1 → none |
Changed in bzr: | |
status: | Confirmed → In Progress |
Changed in bzr: | |
status: | In Progress → Fix Committed |
win32utils. get_unicode_ argv has been changed to explicitly return the current process' command line arguments, however win32utils. _command_ line_to_ argv does what you want to do using the UnicodeShlex class which duplicates shlex functionality in a win32-compatible manner. Is there any reason it must use the Win32 API CommandLineToArgvW rather than this existing function in win32utils?