bzr pull lp:bzr wo ssh key: password prompt + empty password = traceback

Bug #307270 reported by Alexander Belchenko
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Undecided
Unassigned
QBzr
Invalid
Low
Unassigned

Bug Description

Using bzr 1.10 + qbzr trunk revno.551. Trying to test new password prompt dialog.
When I'm simply press Enter or Esc (no matter what exactly) while attempting to connect to Launchpad.net -- there is big traceback in the console.

CLI behavior:

C:\work\Bazaar\plugins\qbzr>bzr pull
Using saved parent location: bzr+ssh://<email address hidden>/~qbzr-dev/qbzr/trunk/
Connected (version 2.0, client Twisted)
SSH <email address hidden> password:
Authentication type (password) not permitted.
bzr: ERROR: Connection error: Unable to authenticate to SSH host as <email address hidden> Bad authentication type (allowed_types=['publickey'])

GUI behavior:

Connected (version 2.0, client Twisted)
Authentication type (password) not permitted.
bzr: ERROR: bzrlib.errors.TooManyConcurrentRequests: The medium '<bzrlib.smart.medium.SmartSSHClientMedium object at 0x00B6E670>' has reached its concurrent request limit. Be sure to finish_writing and finish_reading on the currently open request.

Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 893, in run_bzr_catch_errors
  File "bzrlib\commands.pyo", line 839, in run_bzr
  File "bzrlib\commands.pyo", line 539, in run_argv_aliases
  File "C:\work\Bazaar\plugins\qbzr\lib\commands.py", line 668, in run
  File "bzrlib\commands.pyo", line 839, in run_bzr
  File "bzrlib\commands.pyo", line 539, in run_argv_aliases
  File "bzrlib\builtins.pyo", line 771, in run
  File "bzrlib\branch.pyo", line 123, in open
  File "bzrlib\bzrdir.pyo", line 766, in open
  File "bzrlib\bzrdir.pyo", line 808, in open_from_transport
  File "bzrlib\bzrdir.pyo", line 1770, in open
  File "bzrlib\bzrdir.pyo", line 2646, in _open
  File "bzrlib\remote.pyo", line 93, in __init__
  File "bzrlib\remote.pyo", line 51, in _call
  File "bzrlib\smart\client.pyo", line 122, in call
  File "bzrlib\smart\client.pyo", line 135, in call_expecting_body
  File "bzrlib\smart\client.pyo", line 80, in _call_and_read_response
  File "bzrlib\smart\client.pyo", line 42, in _send_request
  File "bzrlib\smart\client.pyo", line 105, in _construct_protocol
  File "bzrlib\smart\medium.pyo", line 672, in get_request
  File "bzrlib\smart\medium.pyo", line 870, in __init__
TooManyConcurrentRequests: The medium '<bzrlib.smart.medium.SmartSSHClientMedium object at 0x00B6E670>' has reached its concurrent request limit. Be sure to finish_writing and finish_reading on the currently open request.

bzr 1.10 on python 2.5.2 (win32)
arguments: ['C:\\Program Files\\Bazaar\\bzr.EXE', 'qsubprocess', '"pull" "bzr+ssh://<email address hidden>/~qbzr-dev/qbzr/trunk/" "--directory" "file:///C:/work/Bazaar/qbzr-repo/trunk/" "--remember"']
encoding: 'cp1251', fsenc: 'mbcs', lang: 'ru'
plugins:
  bzrtools C:\Program Files\Bazaar\plugins\bzrtools [1.10]
  launchpad C:\Program Files\Bazaar\plugins\launchpad [unknown]
  qbzr C:\work\Bazaar\plugins\qbzr [0.9.6dev]
  rebase C:\work\Bazaar\plugins\rebase [0.4.3dev]
  repo_push C:\work\Bazaar\plugins\repo_push [1.1.1]
  scmproj C:\work\Bazaar\plugins\scmproj [0.2dev]
  x_bit C:\work\Bazaar\plugins\x_bit [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

I think this may be specif to the transport. I could not reproduce it with ftp.

Changed in qbzr:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
John A Meinel (jameinel) wrote :

From what I can tell...

CLIUIFactory will return the empty string for the password (''), I would guess that qbzr is returning None (indicating no password was given, rather than we have a password with no characters).

And I would further guess that individual *users* (such as Transports) of the get_password() api handle None differently from ''.

Digging deeper into the code, whatever password we get back, we pass on to paramiko.Transport.auth_password(). And looking there I see:

if (pkey is not None) or (password is not None):
    if password is not None:
        self._log(DEBUG, 'Attempting password auth...')
        self.auth_password(username, password)

So if you pass in a password of '', then it attempts to authenticate using a password, which is why you get "Bad authentication type" since we are trying to use password auth and only pubkey is allowed.

Trying to dig through it, it would seem that if you pass None to auth_password, it will try to do:
 if self.auth_method == 'password':
     m.add_boolean(False)
     password = self.password
     if isinstance(password, unicode):
         password = password.encode('UTF-8')
     m.add_string(password)

The important thing is that "add_string(None)" causes an exception. Which means it causes a traceback on the client, and probably half-way through the cleanup on the client, this triggers a second "TooManyConcurrentRequest" traceback (during a try/finally:unlock() I would imagine.)

Revision history for this message
John A Meinel (jameinel) wrote :

my analysis may be wrong here.

If I just do:

bzr pull lp:bzr

And then hit <enter> for the password prompts (trying to get my ssh-key password, or just a plain password for the connection) I still get a traceback.

Note that I *don't* get a traceback for just "bzr pull", it is only if I supply a location like "bzr pull lp:qbzr"

Revision history for this message
John A Meinel (jameinel) wrote :

And a good guess as to why that is.

If you supply a location to "bzr pull" we then attempt:

        if location is not None:
            try:
                mergeable = bundle.read_mergeable_from_url(location,
                    possible_transports=possible_transports)
            except errors.NotABundle:
                mergeable = None

However, if you don't supply a location then we only do:

        if location is None:
...
                location = stored_loc
...
        else:
            branch_from = Branch.open(location,
                possible_transports=possible_transports)

So my guess is that the "read_mergeable_from_url" is not handling a disconnect properly.

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

This is actually the bug in bzr itself. To reproduce:

bzr pull lp:bzr
Hit <Enter> on password prompt -- get traceback.

Changed in qbzr:
status: Confirmed → Invalid
Changed in bzr:
status: New → Confirmed
Revision history for this message
Andrew Bennetts (spiv) wrote :

Alexander: I can't reproduce that here, (even if I remove my SSH private key) but I'm on Ubuntu with OpenSSH. I simply get this:

$ bzr pull lp:bzr
Permission denied (publickey).
bzr: ERROR: Connection closed: please check connectivity and permissions (and try -Dhpss if further diagnosis is required)

It's probably orthogonal to your problem, but OpenSSH doesn't even try to ask me for a password, which is correct because the bazaar.launchpad.net server tells the client that only publickey auth is acceptable. So if your SSH client is prompting for a password you should file a bug on it.

Can you reproduce this with "bzr --no-plugins -Dhpss pull bzr+ssh://bazaar.launchpad.net/~bzr/bzr/trunk"? What's in the -Dhpss log?

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

Andrew, thanks for your reply. I think you can reproduce this with command:

$ BZR_SSH=paramiko bzr pull lp:bzr

John Meinel has already confirmed this bug and sent the fix to bzr ML.

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

What happened here ?
Were that bug fixed or not ?

Changed in bzr:
status: Confirmed → Incomplete
Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 307270] Re: bzr pull lp:bzr wo ssh key: password prompt + empty password = traceback

Vincent Ladeuil пишет:
> What happened here ?
> Were that bug fixed or not ?
>
> ** Changed in: bzr
> Status: Confirmed => Incomplete

Today bzr no more asking for password when SSH server (lp) does not support password authentication.
So maybe this bug is no more actual.

Vincent Ladeuil (vila)
Changed in bzr:
status: Incomplete → Fix Released
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.