`bzr commit` fails to invoke editor in non-ascii directory

Bug #680541 reported by Alexander Belchenko
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned

Bug Description

bzr 2.2.1 @ Windows XP

C:\Temp>bzr init Тест
Created a standalone tree (format: 1.14)

C:\Temp\Тест>echo > foo

C:\Temp\Тест>bzr add
adding foo

C:\Temp\Тест>bzr ci foo
Committing to: C:/Temp/Тест/
added foo
aborting commit write group: InvalidURL(Invalid url supplied to transport: "/Temp/%D2%E5%F1%F2/": Unable to encode the URL as ut
f-8: 'utf8' codec can't decode bytes in position 6-7: invalid data)
bzr: ERROR: Invalid url supplied to transport: "/Temp/%D2%E5%F1%F2/": Unable to encode the URL as utf-8: 'utf8' codec can't deco
de bytes in position 6-7: invalid data

I don't understand why it tries to encode russian Тест in cp866 encoding to UTF-8, but I'm sure there is regression with commit.
Not sure is it really important to anybody beside me, so I don't say it terrible critical.

Here is .bzr.log:

0.328 bazaar version: 2.2.1
0.328 bzr arguments: [u'ci', u'foo']
0.359 looking for plugins in C:\work\Bazaar\plugins
0.562 looking for plugins in C:/Program Files/Bazaar/plugins
0.578 Plugin name explorer already loaded
0.578 Plugin name qbzr already loaded
0.593 encoding stdout as sys.stdout encoding 'cp866'
0.703 opening working tree 'C:/Temp/\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82'
0.750 preparing to commit
[ 3996] 2010-11-23 17:56:18.608 INFO: Committing to: C:/Temp/Тест/
0.797 Selecting files for commit with filter [u'foo']
[ 3996] 2010-11-23 17:56:18.625 INFO: added foo
0.890 check paths: [u'foo']
0.922 aborting commit write group because of exception:
0.922 Traceback (most recent call last):
  File "bzrlib\commit.pyo", line 426, in _commit
  File "bzrlib\builtins.pyo", line 3181, in get_message
  File "bzrlib\msgeditor.pyo", line 146, in edit_commit_message_encoded
  File "bzrlib\transport\__init__.pyo", line 1616, in get_transport
  File "bzrlib\transport\__init__.pyo", line 1625, in _try_transport_factories
  File "bzrlib\transport\local.pyo", line 76, in __init__
  File "bzrlib\urlutils.pyo", line 233, in _win32_local_path_from_url
  File "bzrlib\urlutils.pyo", line 578, in unescape
InvalidURL: Invalid url supplied to transport: "/Temp/%D2%E5%F1%F2/": Unable to encode the URL as utf-8: 'utf8' codec can't decode bytes in position 6-7: invalid data

[ 3996] 2010-11-23 17:56:18.750 INFO: aborting commit write group: InvalidURL(Invalid url supplied to transport: "/Temp/%D2%E5%F1%F2/": Unable to encode the URL as utf-8: 'utf8' codec can't decode bytes in position 6-7: invalid data)
0.937 Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 912, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1112, in run_bzr
  File "bzrlib\commands.pyo", line 690, in run_argv_aliases
  File "bzrlib\commands.pyo", line 705, in run
  File "bzrlib\cleanup.pyo", line 135, in run_simple
  File "bzrlib\cleanup.pyo", line 165, in _do_with_cleanups
  File "bzrlib\builtins.pyo", line 3200, in run
  File "bzrlib\decorators.pyo", line 194, in write_locked
  File "bzrlib\workingtree_4.pyo", line 197, in commit
  File "bzrlib\decorators.pyo", line 194, in write_locked
  File "bzrlib\mutabletree.pyo", line 201, in commit
  File "bzrlib\commit.pyo", line 286, in commit
  File "bzrlib\cleanup.pyo", line 131, in run
  File "bzrlib\cleanup.pyo", line 165, in _do_with_cleanups
  File "bzrlib\commit.pyo", line 426, in _commit
  File "bzrlib\builtins.pyo", line 3181, in get_message
  File "bzrlib\msgeditor.pyo", line 146, in edit_commit_message_encoded
  File "bzrlib\transport\__init__.pyo", line 1616, in get_transport
  File "bzrlib\transport\__init__.pyo", line 1625, in _try_transport_factories
  File "bzrlib\transport\local.pyo", line 76, in __init__
  File "bzrlib\urlutils.pyo", line 233, in _win32_local_path_from_url
  File "bzrlib\urlutils.pyo", line 578, in unescape
InvalidURL: Invalid url supplied to transport: "/Temp/%D2%E5%F1%F2/": Unable to encode the URL as utf-8: 'utf8' codec can't decode bytes in position 6-7: invalid data

0.953 Transferred: 0kB (0.0kB/s r:0kB w:0kB)
0.953 return code 3

Revision history for this message
Alexander Belchenko (bialix) wrote :

The problem is in invoking external editor code. Committing with -m or -F option works without any problem.

summary: - `bzr commit` does not work in non-ascii directory
+ `bzr commit` fails to invoke editor in non-ascii directory
Revision history for this message
Alexander Belchenko (bialix) wrote :

Many months ago similar problem was there: https://bugs.launchpad.net/bzr/+bug/84043, but the traceback was different.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Hmm, I recently landed a patch in this area (bug #673637), can you re-try with trunk and report ?

Changed in bzr:
status: New → Confirmed
Revision history for this message
Alexander Belchenko (bialix) wrote :

Vincent, bug #673637 is about not using current directory for temp log file. I don't see how it will help in the case if temp directory will be something like `C:\Documents and Settings\Тест\Local Settings\Temp`?

Revision history for this message
Vincent Ladeuil (vila) wrote :

I know what the bug was about, I'd like to know if I made things worse or better or unchanged (since I modified the code recently it should be easier to add one more fix if needed).

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 680541] Re: `bzr commit` fails to invoke editor in non-ascii directory

Vincent Ladeuil пишет:
> I know what the bug was about, I'd like to know if I made things worse
> or better or unchanged (since I modified the code recently it should be
> easier to add one more fix if needed).

So, new trunk will try to create a temporary file not in the working
directory? Then I should change temp directory to some non-ascii
location? Or do you want me to test with pure ascii-safe temp directory?

--
All the dude wanted was his rug back

Revision history for this message
Vincent Ladeuil (vila) wrote :

>>>>> Alexander Belchenko <email address hidden> writes:

    > Vincent Ladeuil пишет:
    >> I know what the bug was about, I'd like to know if I made things worse
    >> or better or unchanged (since I modified the code recently it should be
    >> easier to add one more fix if needed).

    > So, new trunk will try to create a temporary file not in the working
    > directory?

Yes.

    > Then I should change temp directory to some non-ascii location?
    > Or do you want me to test with pure ascii-safe temp directory?

I'd like to test the actual trunk with your actual setup for one, now if
you can additionnally try with a non-ascii temp dir (it's unclear to me
when that's the case on windows), that would be nice too.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Vincent Ladeuil пишет:
>>>>>> Alexander Belchenko <email address hidden> writes:
>
> > Vincent Ladeuil пишет:
> >> I know what the bug was about, I'd like to know if I made things worse
> >> or better or unchanged (since I modified the code recently it should be
> >> easier to add one more fix if needed).
>
> > So, new trunk will try to create a temporary file not in the working
> > directory?
>
> Yes.
>
> > Then I should change temp directory to some non-ascii location?
> > Or do you want me to test with pure ascii-safe temp directory?
>
> I'd like to test the actual trunk with your actual setup for one, now if
> you can additionnally try with a non-ascii temp dir (it's unclear to me
> when that's the case on windows), that would be nice too.

To test this on Windows I need only change TMP env variable.

--
All the dude wanted was his rug back

Revision history for this message
Michael V. Antosha (mivael) wrote :

Are there fixes for this?
I encounter similar problem.

Revision history for this message
Michael V. Antosha (mivael) wrote :

Note: The file attached to the comment #9 is in CP-1251 encoding (copy-pasted from command line to notepad, and saved as a file).

Revision history for this message
Alexander Belchenko (bialix) wrote :

Michael: on Windows with standalone installer and qbzr there is workaround: invoke bzr qcommit instead of plain bzr commit. Or commit with explicit -m/-F option.

Changed in bzr:
importance: Undecided → Medium
importance: Medium → Low
Revision history for this message
Michael V. Antosha (mivael) wrote :

Thanks for the qcommit hint -- it works!
(I knew about -m/-F, but it's not convenient enough in my case.)

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.