TypeError: prefetch() takes exactly 2 arguments (1 given)

Bug #1579093 reported by Chad Miller
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Critical
Vincent Ladeuil

Bug Description

$ bzr push
Using saved push location: sftp://hostshortnameinsshconfig/home/public/
bzr: ERROR: exceptions.TypeError: prefetch() takes exactly 2 arguments (1 given)

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 930, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 1121, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 673, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 697, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/builtins.py", line 1393, in run
    use_existing_dir=use_existing_dir, no_tree=no_tree)
  File "/usr/lib/python2.7/dist-packages/bzrlib/push.py", line 84, in _show_push_branch
    dir_to = controldir.ControlDir.open_from_transport(to_transport)
  File "/usr/lib/python2.7/dist-packages/bzrlib/controldir.py", line 718, in open_from_transport
    find_format, transport, redirected)
  File "/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.py", line 1719, in do_catching_redirections
    return action(transport)
  File "/usr/lib/python2.7/dist-packages/bzrlib/controldir.py", line 706, in find_format
    probers=probers)
  File "/usr/lib/python2.7/dist-packages/bzrlib/controldir.py", line 1151, in find_format
    return prober.probe_transport(transport)
  File "/usr/lib/python2.7/dist-packages/bzrlib/bzrdir.py", line 1237, in probe_transport
    format_string = transport.get_bytes(".bzr/branch-format")
  File "/usr/lib/python2.7/dist-packages/bzrlib/transport/sftp.py", line 422, in get_bytes
    f = self.get(relpath)
  File "/usr/lib/python2.7/dist-packages/bzrlib/transport/sftp.py", line 414, in get
    f.prefetch()
TypeError: prefetch() takes exactly 2 arguments (1 given)

python-paramiko 1.16.0-1
bzr 2.7.0-2ubuntu1
python-bzrlib 2.7.0-2ubuntu1

Related branches

Revision history for this message
Chad Miller (cmiller) wrote :

In paramiko sftp_file.py,

SFTPFile.prefetch takes a file_size parameter after self.

Chad Miller (cmiller)
Changed in bzr:
status: New → Confirmed
Revision history for this message
Vincent Ladeuil (vila) wrote :

@Chad: which ubuntu release ?

> SFTPFile.prefetch takes a file_size parameter after self.

I'm aware of the issue but not up to date, last time I looked the parameter value couldn't be guessed by the caller and internally the default was from a private attribute :-/

Revision history for this message
Chad Miller (cmiller) wrote :

There's some crazy paramiko version testing that determines whether prefetch is called at all. Maybe another test is in order.

Which release of what? You mean perhaps "yakkety"? Bzr/Paramiko version numbers are at the bottom of the description.

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

> There's some crazy paramiko version testing that determines whether prefetch is called at all.

Yup, dating from when prefetch was introduced in paramiko, clearly more confusing than relevant theses days.

> Maybe another test is in order.

I was hoping for paramiko to not break backwards compatibility:

https://github.com/paramiko/paramiko/issues/676

Too bad I only discover the above issue (with a proper fix) today (I think this came up from debian but can't find the relevant discussion anymore) :-/

If I'm reading this correctly, paramiko 1.16.2 will fix the compatibility issue.

>> @Chad: which ubuntu release ?
> Which release of what? You mean perhaps "yakkety"?
Yeah, I meant ubuntu but checked with rmadison afterwards:
 python-paramiko | 1.16.0-1 | xenial | all
 python-paramiko | 1.16.0-1 | yakkety | all

Which would mean paramiko was able to enter xenial despite dep8 tests that should have caught that regression :-/

Anyway, in the mean time, as a workaround, you may be able to bzr+ssh instead of sftp (which is inherently slower) ?

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

... otherwise, if we can't get paramiko 1.16.2 in, yes, a test for that specific version will be the way to go.

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

Also, can someone confirm that using bzr+ssh instead of sftp avoids the issue ?

Revision history for this message
Jeff Lane  (bladernr) wrote :

@vila Yeah, bzr+ssh seems to work just fine. It's just sftp and paramiko that's broke for me.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

FWIW this is the patch we use in Debian (which only works with newer versions of paramiko):

https://alioth.debian.org/scm/loggerhead/bzr/pkg-bazaar/bzr/2.7/view/head:/debian/patches/16_paramiko_compat

Vincent Ladeuil (vila)
Changed in bzr:
status: Confirmed → In Progress
importance: Undecided → Critical
assignee: nobody → Vincent Ladeuil (vila)
milestone: none → 2.7.1
Jelmer Vernooij (jelmer)
Changed in bzr:
status: In Progress → Fix Committed
Vincent Ladeuil (vila)
Changed in bzr:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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