Unable to use any options with apt ssh/rsh acquire method

Bug #678080 reported by Ville Mattila
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: apt

Apt ssh (and rsh) acquire method fails if any Acquire::ssh::Options are configured: For example with the setting "Acquire::ssh::Options { "-F"; "/etc/apt/ssh/config"; };), apt will try to run the command '-F /etc/apt/ssh/config ssh ...' and fails. Of course, the correct command would be 'ssh -F /etc/apt/ssh/config'.

This bug exists in current versions of apt for at least the following Ubuntu versions:
- upcoming 11.04 (natty): apt-0.8.9ubuntu2
- 10.04.1 (lucid): apt-0.7.25.3ubuntu9.3
- 8.04 (hardy): apt-0.7.9ubuntu17.2
(And in all current Debian's apt versions, too.)

The fix a is trivial one line move in methods/rsh.cc and identical for all the versions listed above. See the attached file 'fix_rshoptions_parsing.patch'.

As a workaround I have to use a script /usr/bin/apt-ssh-workaround which simply strips out 'ssh' from it's arguments and passes on all others to /usr/bin/ssh and then add the name of the script as the first argument in Acquire::ssh::Options:

$ cat /etc/apt/apt.conf.d/95workaround-ssh-options-parser-bug
Acquire::ssh::Options { "apt-ssh-workaround"; "-F"; "/etc/apt/ssh/ssh_config" };
$ cat /usr/bin/apt-ssh-workaround
#!/usr/bin/perl -w
# Wrapper to workaround Acquire::ssh::Options parser bug, 20101116VM
use strict;
use warnings FATAL => qw(all);

# Copy everything but 'ssh' from @ARGV to @args.
my(@args);
foreach (@ARGV) {
  push @args, $_ unless ($_ eq 'ssh');
}

exec("ssh", @args);
$

Tags: patch

Related branches

Revision history for this message
Ville Mattila (vmattila) wrote :
tags: added: patch
Revision history for this message
Torsten Spindler (tspindler) wrote :

I've built a test package in https://launchpad.net/~tspindler/+archive/apt. Can you test it, best on an expendable virtual machine, and report if it fixes the issue for you?

Unfortunately I could not test the fix, as my apt also works with the old acquire option, I guess it does fall back to non ssh/rsh use when the connection does not work.

Revision history for this message
Ville Mattila (vmattila) wrote :

apt-0.8.11.5ubuntu3~tetet2 from your PPA repository does seem to fix the issue.

I tried it with
  Acquire::ssh::Options { "-F"; "/etc/apt/ssh/ssh_config" };
on 11.04 Natty alpha-3 live image. If necessary I can test the changes on 10.04 Lucid (and 10.10 Maverick), too, at least if you can provide the binary packages.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt - 0.8.13ubuntu1

---------------
apt (0.8.13ubuntu1) natty; urgency=low

  * merged from debian/sid, this adds important fixes in the
    apt mirror method

apt (0.8.13) unstable; urgency=low

  [ Thorsten Spindler ]
  * methods/rsh.cc
    - fix rsh/ssh option parsing (LP: #678080), thanks to
      Ville Mattila

  [ Michael Vogt ]
  * apt-pkg/acquire-item.cc:
    - mark pkgAcqIndexTrans as Index-File to avoid asking the
      user to insert the CD on each apt-get update
  * po/sl.po:
    - updated, thanks to Andrej Znidarsic
  * mirror method:
    - when downloading data, show the mirror being used
    - randomize mirror list after download in a host specific way
      to ensure that the load is evenly spreaded accross the mirrors
    - fix some missing "Fail-Ignore"
 -- Michael Vogt <email address hidden> Wed, 16 Mar 2011 08:23:19 +0100

Changed in apt (Ubuntu):
status: New → Fix Released
Revision history for this message
Frederic Van Espen (frederic-ve) wrote :

I am quite surprised to see that this critical bug, that renders apt over ssh unusable if you want to use ssh options, is not fixed in at least an LTS version of ubuntu after 1.5 years after it has been reported.

I'm even more surprised that this isn't fixed in LTS when the exact patch is given by the reporter.

Revision history for this message
Michael Vogt (mvo) wrote :

Hey Frederic, thanks for your mail.

This is confusing, the apt version in precise (12.04) I get via apt-get source apt does contain your patch. Is there some other problem somewhere maybe that is unrelated to the patch or a different kind of regression ?

Revision history for this message
Frederic Van Espen (frederic-ve) wrote :

Hello Michael, thanks for your quick response.

I'm using the lucid (10.04) LTS server release. In there it's not fixed yet.

It was actually broken a long time ago (read 8 years) in r859 of the rsh.cc file.

For now I just fixed it by applying the patch with apt-get source apt and rebuilding the package.

Revision history for this message
Torsten Spindler (tspindler) wrote :

@Frederic: Does the work around in the bug description with the ssh shell script call work for you on 10.04 LTS? The only path to fix this problem on 10.04 LTS would be to use the SRU process, which is a bit involved. Given that according to the bug status only two people are affected and a work around is found in the bug description, chances for this to proceed is low.

Revision history for this message
Frederic Van Espen (frederic-ve) wrote :

Hello Torsten,

I can confirm that the work around does work on 10.04.

I guess not much people actually use apt over ssh.

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.