summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/cacheset.cc3
-rwxr-xr-xtest/integration/test-apt-cli-show4
2 files changed, 7 insertions, 0 deletions
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index bfc85ef49..230e3d68f 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -60,6 +60,9 @@ bool CacheSetHelper::PackageFromTask(PackageContainerInterface * const pci, pkgC
pattern.erase(archfound);
}
+ if (pattern.empty())
+ return false;
+
if (pattern[pattern.length() -1] != '^')
return false;
pattern.erase(pattern.length()-1);
diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show
index 05a801f6a..010775d9b 100755
--- a/test/integration/test-apt-cli-show
+++ b/test/integration/test-apt-cli-show
@@ -28,6 +28,10 @@ setupaptarchive
APTARCHIVE=$(readlink -f ./aptarchive)
+testfailureequal "N: Unable to locate package :
+N: Unable to locate package :
+E: No packages found" apt show :
+
# note that we do not display Description-md5 with the "apt" cmd
# and also show some additional fields that are calculated
testsuccessequal "Package: foo