On Fri, Aug 30, 2013 at 06:33:47PM +0700, Sayid Munawar wrote: > Package: apt > Version: 0.9.11.1 > Severity: normal
Thanks for your bugreport. [..] > * What exactly did you do (or not do) that was effective (or > ineffective)? > trying to reproduce with simple command: > # apt-get install --no-install-recommends -- wget > E: Command line option --no-install-recommends is not understood > > it will work without "--" > # apt-get install --no-install-recommends wget > Reading package lists... Done > > * What was the outcome of this action? > any command/script about to install with --no-install-recommends and > -- will not work > > * What outcome did you expect instead? > it shoould work with -- or without -- > it works in apt version 0.9.7.8, but not in 0.9.11.1 This is a unintended side-effect of the commandline parsing that got stricter in 0.9.11.1, as a quick workaround you can use (i.e. option before command): # apt-get --no-install-recommends install -- wget Attached is a diff that should fix the issue, I would appreciate review as I'm not sure I 100% get the original idea behind the current code. We may also get away with making it easier and simply not allow commands after "--" this would mean we can eliminate the "stop" variable. Cheers, Michael > -- Package-specific info: > > -- apt-config dump -- > > APT ""; > APT::Architecture "amd64"; > APT::Build-Essential ""; > APT::Build-Essential:: "build-essential"; > APT::Install-Recommends "1"; > APT::Install-Suggests "0"; > APT::Authentication ""; > APT::Authentication::TrustCDROM "true"; > APT::NeverAutoRemove ""; > APT::NeverAutoRemove:: "^firmware-linux.*"; > APT::NeverAutoRemove:: "^linux-firmware$"; > APT::NeverAutoRemove:: "^kfreebsd-image.*"; > APT::NeverAutoRemove:: "^gnumach$"; > APT::NeverAutoRemove:: "^gnumach-image.*"; > APT::NeverAutoRemove:: "^linux-image-3.10-1-amd64$"; > APT::NeverAutoRemove:: "^linux-image-extra-3.10-1-amd64$"; > APT::NeverAutoRemove:: "^linux-signed-image-3.10-1-amd64$"; > APT::NeverAutoRemove:: "^linux-backports-modules-.*-3.10-1-amd64$"; > APT::NeverAutoRemove:: "^linux-headers-3.10-1-amd64$"; > APT::Never-MarkAuto-Sections ""; > APT::Never-MarkAuto-Sections:: "metapackages"; > APT::Never-MarkAuto-Sections:: "restricted/metapackages"; > APT::Never-MarkAuto-Sections:: "universe/metapackages"; > APT::Never-MarkAuto-Sections:: "multiverse/metapackages"; > APT::Never-MarkAuto-Sections:: "oldlibs"; > APT::Never-MarkAuto-Sections:: "restricted/oldlibs"; > APT::Never-MarkAuto-Sections:: "universe/oldlibs"; > APT::Never-MarkAuto-Sections:: "multiverse/oldlibs"; > APT::Architectures ""; > APT::Architectures:: "amd64"; > APT::Compressor ""; > APT::Compressor::. ""; > APT::Compressor::.::Name "."; > APT::Compressor::.::Extension ""; > APT::Compressor::.::Binary ""; > APT::Compressor::.::Cost "1"; > APT::Compressor::gzip ""; > APT::Compressor::gzip::Name "gzip"; > APT::Compressor::gzip::Extension ".gz"; > APT::Compressor::gzip::Binary "gzip"; > APT::Compressor::gzip::Cost "2"; > APT::Compressor::gzip::CompressArg ""; > APT::Compressor::gzip::CompressArg:: "-9n"; > APT::Compressor::gzip::UncompressArg ""; > APT::Compressor::gzip::UncompressArg:: "-d"; > APT::Compressor::bzip2 ""; > APT::Compressor::bzip2::Name "bzip2"; > APT::Compressor::bzip2::Extension ".bz2"; > APT::Compressor::bzip2::Binary "bzip2"; > APT::Compressor::bzip2::Cost "3"; > APT::Compressor::bzip2::CompressArg ""; > APT::Compressor::bzip2::CompressArg:: "-9"; > APT::Compressor::bzip2::UncompressArg ""; > APT::Compressor::bzip2::UncompressArg:: "-d"; > APT::Compressor::xz ""; > APT::Compressor::xz::Name "xz"; > APT::Compressor::xz::Extension ".xz"; > APT::Compressor::xz::Binary "xz"; > APT::Compressor::xz::Cost "4"; > APT::Compressor::xz::CompressArg ""; > APT::Compressor::xz::CompressArg:: "-6"; > APT::Compressor::xz::UncompressArg ""; > APT::Compressor::xz::UncompressArg:: "-d"; > APT::Compressor::lzma ""; > APT::Compressor::lzma::Name "lzma"; > APT::Compressor::lzma::Extension ".lzma"; > APT::Compressor::lzma::Binary "xz"; > APT::Compressor::lzma::Cost "5"; > APT::Compressor::lzma::CompressArg ""; > APT::Compressor::lzma::CompressArg:: "--format=lzma"; > APT::Compressor::lzma::CompressArg:: "-9"; > APT::Compressor::lzma::UncompressArg ""; > APT::Compressor::lzma::UncompressArg:: "--format=lzma"; > APT::Compressor::lzma::UncompressArg:: "-d"; > APT::Compressor::::Name ""; > APT::Compressor::::Extension "."; > APT::Compressor::::Binary ""; > APT::Compressor::::Cost "100"; > APT::Compressor::::CompressArg ""; > APT::Compressor::::CompressArg:: "-9"; > APT::Compressor::::UncompressArg ""; > APT::Compressor::::UncompressArg:: "-d"; > Dir "/"; > Dir::State "var/lib/apt/"; > Dir::State::lists "lists/"; > Dir::State::cdroms "cdroms.list"; > Dir::State::mirrors "mirrors/"; > Dir::State::extended_states "extended_states"; > Dir::State::status "/var/lib/dpkg/status"; > Dir::Cache "var/cache/apt/"; > Dir::Cache::archives "archives/"; > Dir::Cache::srcpkgcache "srcpkgcache.bin"; > Dir::Cache::pkgcache "pkgcache.bin"; > Dir::Etc "etc/apt/"; > Dir::Etc::sourcelist "sources.list"; > Dir::Etc::sourceparts "sources.list.d"; > Dir::Etc::vendorlist "vendors.list"; > Dir::Etc::vendorparts "vendors.list.d"; > Dir::Etc::main "apt.conf"; > Dir::Etc::netrc "auth.conf"; > Dir::Etc::parts "apt.conf.d"; > Dir::Etc::preferences "preferences"; > Dir::Etc::preferencesparts "preferences.d"; > Dir::Etc::trusted "trusted.gpg"; > Dir::Etc::trustedparts "trusted.gpg.d"; > Dir::Bin ""; > Dir::Bin::methods "/usr/lib/apt/methods"; > Dir::Bin::solvers ""; > Dir::Bin::solvers:: "/usr/lib/apt/solvers"; > Dir::Bin::dpkg "/usr/bin/dpkg"; > Dir::Bin::bzip2 "/bin/bzip2"; > Dir::Bin::xz "/usr/bin/xz"; > Dir::Media ""; > Dir::Media::MountPath "/media/cdrom"; > Dir::Log "var/log/apt"; > Dir::Log::Terminal "term.log"; > Dir::Log::History "history.log"; > Dir::Ignore-Files-Silently ""; > Dir::Ignore-Files-Silently:: "~$"; > Dir::Ignore-Files-Silently:: "\.disabled$"; > Dir::Ignore-Files-Silently:: "\.bak$"; > Dir::Ignore-Files-Silently:: "\.dpkg-[a-z]+$"; > Dir::Ignore-Files-Silently:: "\.save$"; > Dir::Ignore-Files-Silently:: "\.orig$"; > Acquire ""; > Acquire::cdrom ""; > Acquire::cdrom::mount "/media/cdrom"; > Acquire::Languages ""; > Acquire::Languages:: "en"; > Acquire::Languages:: "none"; > DPkg ""; > DPkg::Pre-Install-Pkgs ""; > DPkg::Pre-Install-Pkgs:: "/usr/bin/apt-listchanges --apt || test $? -ne 10"; > DPkg::Pre-Install-Pkgs:: "/usr/sbin/dpkg-preconfigure --apt || true"; > DPkg::Tools ""; > DPkg::Tools::Options ""; > DPkg::Tools::Options::/usr/bin/apt-listchanges ""; > DPkg::Tools::Options::/usr/bin/apt-listchanges::Version "2"; > CommandLine ""; > CommandLine::AsString "apt-config dump"; > > -- (no /etc/apt/preferences present) -- > > > -- /etc/apt/sources.list -- > > # > > # deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 CD Binary-1 > 20130504-14:44]/ wheezy main > > #deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 CD Binary-1 > 20130504-14:44]/ wheezy main > > deb http://kambing.ui.ac.id/debian sid main contrib > > -- System Information: > Debian Release: jessie/sid > APT prefers unstable > APT policy: (500, 'unstable') > Architecture: amd64 (x86_64) > > Kernel: Linux 3.10-1-amd64 (SMP w/4 CPU cores) > Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: > LC_ALL set to en_US.UTF-8) > Shell: /bin/sh linked to /bin/dash > > Versions of packages apt depends on: > ii debian-archive-keyring 2012.4 > ii gnupg 1.4.14-1 > ii libapt-pkg4.12 0.9.11.1 > ii libc6 2.17-92 > ii libgcc1 1:4.7.2-5 > ii libstdc++6 4.7.2-5 > > apt recommends no packages. > > Versions of packages apt suggests: > pn apt-doc <none> > ii aptitude 0.6.8.2-1 > pn dpkg-dev <none> > ii python-apt 0.8.9.1+b1 > ii xz-utils 5.1.1alpha+20120614-2 > > -- no debconf information > > > -- > To UNSUBSCRIBE, email to deity-requ...@lists.debian.org > with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org > Archive: > http://lists.debian.org/20130830113347.14682.55909.report...@node1.dot.jc >
>From 4d8bb66e6e5736d4d1d8bfa04400131aaaa15f41 Mon Sep 17 00:00:00 2001 From: Michael Vogt <m...@debian.org> Date: Sat, 31 Aug 2013 18:02:12 +0200 Subject: [PATCH] improve CommandLine::GetCommand() to support "apt-get install -f -s -- 2vcard" again --- apt-pkg/contrib/cmndline.cc | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc index 2086d91..ffcf09c 100644 --- a/apt-pkg/contrib/cmndline.cc +++ b/apt-pkg/contrib/cmndline.cc @@ -42,34 +42,28 @@ CommandLine::~CommandLine() char const * CommandLine::GetCommand(Dispatch const * const Map, unsigned int const argc, char const * const * const argv) { - // if there is a -- on the line there must be the word we search for around it - // as -- marks the end of the options, just not sure if the command can be - // considered an option or not, so accept both - for (size_t i = 1; i < argc; ++i) - { - if (strcmp(argv[i], "--") != 0) - continue; - ++i; - if (i < argc) - for (size_t j = 0; Map[j].Match != NULL; ++j) - if (strcmp(argv[i], Map[j].Match) == 0) - return Map[j].Match; - i -= 2; - if (i != 0) - for (size_t j = 0; Map[j].Match != NULL; ++j) - if (strcmp(argv[i], Map[j].Match) == 0) - return Map[j].Match; - return NULL; - } - // no --, so search for the first word matching a command - // FIXME: How like is it that an option parameter will be also a valid Match ? + bool stop = false; for (size_t i = 1; i < argc; ++i) { + // a "--" marks the end of option processing, but we still check + // the next word as it might be a command + if (strcmp(argv[i], "--") == 0) + { + stop = true; + continue; + } + // a option, not a command so we ignore it if (*(argv[i]) == '-') continue; + + // check if its a valid command for (size_t j = 0; Map[j].Match != NULL; ++j) if (strcmp(argv[i], Map[j].Match) == 0) return Map[j].Match; + + // the previous option was "--" + if(stop) + break; } return NULL; } -- 1.8.3.2