diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2020-10-26 13:54:26 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2020-10-26 14:33:55 +0100 |
commit | 9cc002939afc0d2283fd2f5e7d6e7434af5d10ff (patch) | |
tree | a51b37421903539d7d0b45fec8d2a52874fa751d | |
parent | 5d4a9e4b595ec145cdbe30b4f43d6bcdf9f26b2e (diff) |
pkgnames: Correctly set the default for AllNames to false
We passed "false" instead of false, and that apparently got
cast to bool, because it's a non-null pointer.
LP: #1876495
-rw-r--r-- | cmdline/apt-cache.cc | 2 | ||||
-rwxr-xr-x | test/integration/test-ubuntu-bug-1876495-pkgnames-virtual | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 23ab7e47f..b40ff6efa 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -980,7 +980,7 @@ static bool ShowPkgNames(CommandLine &CmdL) if (unlikely(CacheFile.BuildCaches(NULL, false) == false)) return false; pkgCache::GrpIterator I = CacheFile.GetPkgCache()->GrpBegin(); - bool const All = _config->FindB("APT::Cache::AllNames","false"); + bool const All = _config->FindB("APT::Cache::AllNames", false); if (CmdL.FileList[1] != 0) { diff --git a/test/integration/test-ubuntu-bug-1876495-pkgnames-virtual b/test/integration/test-ubuntu-bug-1876495-pkgnames-virtual new file mode 100755 index 000000000..77d68e085 --- /dev/null +++ b/test/integration/test-ubuntu-bug-1876495-pkgnames-virtual @@ -0,0 +1,23 @@ + +#!/bin/sh + +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'i386' + +insertinstalledpackage 'coolstuff' 'all' '1.0' 'Provides: virtual-package +Source: source-package' + +setupaptarchive +changetowebserver + +testsuccess aptget update -o Debug::Acquire::gpg=1 +testsuccessequal "coolstuff +dpkg" aptcache pkgnames + +testsuccessequal "source-package +coolstuff +dpkg" aptcache pkgnames --all-names |