Character encoding problem when pushing through sftp from win32 to linux

Bug #513701 reported by Léo Studer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Undecided
Unassigned
QBzr
Confirmed
Medium
Unassigned

Bug Description

I can't push through sftp between win32 and linux, I have to use a usb drive and this is very annoying ! Here is the traceback of the problem: (I've tryed with and without accentuated characters in the win32 path, same story in both cases)

Connected (version 2.0, client OpenSSH_5.1p1)
Adding ssh-rsa host key for (xxxxxxxxxxxxxxxxxxxprivacymattersxxxxxxxxxxxxxxxxxxx)
bzr: ERROR: exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 5: ordinal not in range(128)

Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 842, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1037, in run_bzr
  File "bzrlib\commands.pyo", line 654, in run_argv_aliases
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\commands.py", line 787, in run
  File "bzrlib\commands.pyo", line 1037, in run_bzr
  File "bzrlib\commands.pyo", line 654, in run_argv_aliases
  File "bzrlib\builtins.pyo", line 1156, in run
  File "bzrlib\push.pyo", line 83, in _show_push_branch
  File "bzrlib\bzrdir.pyo", line 874, in open_from_transport
  File "bzrlib\transport\__init__.pyo", line 1642, in do_catching_redirections
  File "bzrlib\bzrdir.pyo", line 861, in find_format
  File "bzrlib\bzrdir.pyo", line 1797, in find_format
  File "bzrlib\bzrdir.pyo", line 1807, in probe_transport
  File "bzrlib\transport\sftp.pyo", line 427, in get
  File "bzrlib\transport\sftp.pyo", line 399, in _get_sftp
  File "bzrlib\transport\sftp.pyo", line 391, in _create_connection
  File "bzrlib\transport\ssh.pyo", line 325, in connect_sftp
  File "bzrlib\transport\ssh.pyo", line 321, in _connect
  File "bzrlib\transport\ssh.pyo", line 529, in _paramiko_auth
  File "bzrlib\config.pyo", line 1248, in get_password
  File "C:/Program Files/Bazaar/plugins\qbzr\lib\subprocess.py", line 647, in get_password
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 5: ordinal not in range(128)

bzr 2.0.4 on python 2.5.4 (Windows-XP-5.1.2600-SP3)
arguments: ['C:\\Program Files\\Bazaar\\bzr.exe', 'qsubprocess', '--bencode', 'l4:push70:sftp://xxxxxxxxxxx/media/virtual/PartageVirtuel/ALACARTE_Lagamine/11:--directory75:C:/Documents and Settings/L\xe9o Studer/Local Settings/Temp/ALACARTE_Lagamine10:--remember11:--no-stricte']
encoding: 'cp1252', fsenc: 'mbcs', lang: 'FR'
plugins:
  bzrtools C:\Program Files\Bazaar\plugins\bzrtools [2.0.1]
  explorer C:\Program Files\Bazaar\plugins\explorer [0.8.3]
  launchpad C:\Program Files\Bazaar\plugins\launchpad [2.0.4]
  netrc_credential_store C:\Program Files\Bazaar\plugins\netrc_credential_store [2.0.4]
  qbzr C:\Program Files\Bazaar\plugins\qbzr [0.14.6]
  rebase C:\Program Files\Bazaar\plugins\rebase [0.5.4]
  svn C:\Program Files\Bazaar\plugins\svn [1.0.0]
  upload C:\Program Files\Bazaar\plugins\upload [1.0.0dev]
  xmloutput C:\Program Files\Bazaar\plugins\xmloutput [0.8.5]

*** 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://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.

Léo Studer (leo-studer)
description: updated
Revision history for this message
Léo Studer (leo-studer) wrote :

Figured out that bzr was passing the Windows user name for ssh authetication, which contains accentuated characters. If I specify the user name manually when pushing, all goes fine.

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 513701] [NEW] Character encoding problem when pushing through sftp from win32 to linux

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Léo Studer wrote:
> Public bug reported:
>
> I can't push through sftp between win32 and linux, I have to use a usb
> drive and this is very annoying ! Here is the traceback of the problem:
> (I've tryed with and without accentuated characters in the win32 path,
> same story in both cases)
>
> Connected (version 2.0, client OpenSSH_5.1p1)
> Adding ssh-rsa host key for (xxxxxxxxxxxxxxxxxxxprivacymattersxxxxxxxxxxxxxxxxxxx)
> bzr: ERROR: exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 5: ordinal not in range(128)
>

qbzr seems to be having difficulties with your non-ascii workspace (in
$TEMP).

It is possible that if you used plain 'bzr push' from a terminal it
would work better. It is also possible that this may be fixed in the
2.1.0rc1 release (which includes a newer qbzr).

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkthY6kACgkQJdeBCYSNAAM0cwCaAkltAN2azv5y8T79lX0FjBAQ
Gu0An0b0qpsAIb/h0p+EqYuiaMeOgUws
=R8qS
-----END PGP SIGNATURE-----

Martin Pool (mbp)
affects: bzr → qbzr
Revision history for this message
Alexander Belchenko (bialix) wrote :

Launchpad Bug Tracker пишет:
> You have been subscribed to a public bug:
>
> I can't push through sftp between win32 and linux, I have to use a usb
> drive and this is very annoying ! Here is the traceback of the problem:
> (I've tryed with and without accentuated characters in the win32 path,
> same story in both cases)
>
> Connected (version 2.0, client OpenSSH_5.1p1)
> Adding ssh-rsa host key for (xxxxxxxxxxxxxxxxxxxprivacymattersxxxxxxxxxxxxxxxxxxx)
> bzr: ERROR: exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 5: ordinal not in range(128)

Do you have login name or some other in prompt from server that is not
ASCII? In French I suppose?

I think the problem is in bzr itself.

Can you run following command in the console (not in GUI) from the
directory where you branch located:

bzr push sftp://xxxxxxxxxxx/media/virtual/PartageVirtuel/ALACARTE_Lagamine/

Change xxxxxxxxon real host name or IP address.
Then copy the console session so I can see how it works for you:
right-click on console icon, select Edit > Mark; then draw with mouse
selection region and press Enter; paste to mail/browser as usual.

Even if this command will succeed I need to understand what exactly
non-ascii there. So please, if you will substitute real data with xxx
then marks the places where non-ascii characters appears.

Changed in qbzr:
status: New → Incomplete
Revision history for this message
Léo Studer (leo-studer) wrote :

Yes, my win32 login has non-ascii characters (french accentuated ones).

If I directly run the push command (without specifying a user name, thus using the defaut win32 one) from the terminal I get the same error output.

If I specify my linux user name in the push command (ie sftp://user@ip_adress/media/virtual/PartageVirtuel/ALACARTE_Lagamine/ then the push goes well

So this is somehow not qbzr related

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

The real bug in bzr itself: UIFactory methods, like get_password() accept prompt which in fact is not unicode, but it treated as unicode, see prompt method:

prompt = prompt.encode(osutils.get_terminal_encoding(), 'replace')

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

Léo, as workaround please add the host you need to push into authentication.conf config file (it's in your bazaar config folder, see the output of bzr version).

You need to add something like that:

[my-linux-ssh-server]
host = xxxxxx # real host name/address here
user = my-login-on-server # your login name
scheme = ssh

the file should be in utf-8 encoding.

Changed in qbzr:
importance: Undecided → Medium
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.