summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2018-11-21 10:28:04 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2018-11-21 10:42:25 +0100
commit0e688a252568901e0b7b0eb2b53c396e62bf4d61 (patch)
tree3b605f0cc315f5e5d985c045b821230b25cb0cc1
parent5d1dfd120a5a80b126f3a7eeb29b4fd962d7191d (diff)
Print useful error on "apt changelog" without arguments
Fixes Debian/apt#77
-rw-r--r--apt-private/private-download.cc2
-rwxr-xr-xtest/integration/test-apt-get-changelog5
2 files changed, 6 insertions, 1 deletions
diff --git a/apt-private/private-download.cc b/apt-private/private-download.cc
index 8bd7e33e0..2c12676ea 100644
--- a/apt-private/private-download.cc
+++ b/apt-private/private-download.cc
@@ -248,7 +248,7 @@ bool DoChangelog(CommandLine &CmdL)
APT::VersionList verset = APT::VersionList::FromCommandLine(Cache,
CmdL.FileList + 1, APT::CacheSetHelper::CANDIDATE, helper);
if (verset.empty() == true)
- return false;
+ return _error->Error(_("No packages found"));
bool const downOnly = _config->FindB("APT::Get::Download-Only", false);
bool const printOnly = _config->FindB("APT::Get::Print-URIs", false);
diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog
index 15c3dd50f..9ac9b063a 100755
--- a/test/integration/test-apt-get-changelog
+++ b/test/integration/test-apt-get-changelog
@@ -132,3 +132,8 @@ testfilestats 'dpkg.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAU
head -n 3 dpkg.changelog > dpkg.change
testfileequal 'dpkg.change' "$(apthelper cat-file 'rootdir/usr/share/doc/dpkg/changelog' | head -n 3)"
rm -f dpkg.change dpkg.changelog
+
+# no package specified
+testfailureequal 'E: No packages found' aptget changelog
+testfailureequal 'E: Unable to locate package clclclclc
+E: No packages found' aptget changelog clclclclc