`bzr add file1 file2` in non-ascii folder fails, but `bzr add file1` works
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Low
|
Martin Packman | ||
2.0 |
Fix Released
|
Low
|
Martin Packman | ||
2.1 |
Fix Released
|
Low
|
Martin Packman | ||
2.2 |
Fix Released
|
Low
|
Martin Packman |
Bug Description
bzr 2.2.1 @ windows. Very weird behavior:
C:\work\
bzr: ERROR: exceptions.
Traceback (most recent call last):
File "bzrlib\
File "bzrlib\
File "bzrlib\
File "bzrlib\
File "bzrlib\
File "bzrlib\
File "bzrlib\
File "bzrlib\
File "bzrlib\
File "bzrlib\
File "bzrlib\
File "ntpath.pyo", line 108, in join
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 15: ordinal not in range(128)
bzr 2.2.1 on python 2.6.4 (Windows-
arguments: ['C:\\Program Files\\
encoding: 'cp1251', fsenc: 'mbcs', lang: None
plugins:
acad C:\work\
bzrtools C:\Program Files\Bazaar\
colo C:\work\
explorer C:\work\
format1 C:\work\
kftp C:\work\
launchpad C:\Program Files\Bazaar\
qbzr C:\work\
rewrite C:\Program Files\Bazaar\
scmproj C:\work\
x_bit C:\work\
*** Bazaar has encountered an internal error. This probably indicates a
bug in Bazaar. You can help us fix it by filing a bug report at
https:/
including this traceback and a description of the problem.
But adding the same files one by one works:
C:\work\
adding Makefile
C:\work\
adding apvs-protocol.txt
Related branches
- Vincent Ladeuil: Approve
- Martin Pool: Approve
-
Diff: 55 lines (+17/-2)3 files modifiedNEWS (+3/-0)
bzrlib/mutabletree.py (+3/-1)
bzrlib/tests/blackbox/test_add.py (+11/-1)
summary: |
- `bzr add file1 file2` in non-ascii folder fails + `bzr add file1 file2` in non-ascii folder fails, but `bzr add file1` + works |
Changed in bzr: | |
status: | Confirmed → Fix Released |
Fun bug. This is a regression from the fix for bug 192859 specifically in r4634.159.8 on trunk. The problem only manifests with relative paths, and as noted only with more than once filename.
The basic issue is in trying to turn a (unicode) relative path into an absolute path with a (bytestring) cwd.
In cmd_add.run: for_add( file_list) relpath)
tree, file_list = tree_files_
In tree_files_for_add:
file_list = file_list[:]
file_list[0] = tree.abspath(
Which explains why passing one file at a time works, the first file given is preabsoluted.
In MutableTree. smart_add: normalizepath, file_list)
# expand any symlinks in the directory part, while leaving the
# filename alone
file_list = map(osutils.
There's the boom on Python 2.5 or earlier, that goes down to os.path.abspath which dies on a unicode argument and non-ascii cwd: bugs.python. org/issue3426>
<http://