summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmdline/apt-cache.cc10
-rwxr-xr-xtest/integration/test-ubuntu-bug-1876495-pkgnames-virtual3
2 files changed, 5 insertions, 8 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index b40ff6efa..ffe650970 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -986,9 +986,7 @@ static bool ShowPkgNames(CommandLine &CmdL)
{
for (;I.end() != true; ++I)
{
- if (All == false && I->FirstPackage == 0)
- continue;
- if (I.FindPkg("any")->VersionList == 0)
+ if (All == false && (I.PackageList().end() || I.PackageList()->VersionList == 0))
continue;
if (strncmp(I.Name(),CmdL.FileList[1],strlen(CmdL.FileList[1])) == 0)
cout << I.Name() << endl;
@@ -1000,13 +998,11 @@ static bool ShowPkgNames(CommandLine &CmdL)
// Show all pkgs
for (;I.end() != true; ++I)
{
- if (All == false && I->FirstPackage == 0)
- continue;
- if (I.FindPkg("any")->VersionList == 0)
+ if (All == false && (I.PackageList().end() || I.PackageList()->VersionList == 0))
continue;
cout << I.Name() << endl;
}
-
+
return true;
}
/*}}}*/
diff --git a/test/integration/test-ubuntu-bug-1876495-pkgnames-virtual b/test/integration/test-ubuntu-bug-1876495-pkgnames-virtual
index 77d68e085..00a767479 100755
--- a/test/integration/test-ubuntu-bug-1876495-pkgnames-virtual
+++ b/test/integration/test-ubuntu-bug-1876495-pkgnames-virtual
@@ -20,4 +20,5 @@ dpkg" aptcache pkgnames
testsuccessequal "source-package
coolstuff
-dpkg" aptcache pkgnames --all-names
+dpkg
+virtual-package" aptcache pkgnames --all-names