Bug#705510: apt: apt-get [dist-]upgrade takes no args, so enforce that
Package: apt
Version: 0.9.7.9~exp3
Severity: minor
Tags: patch
Dear deity
apt-get upgrade and dist-upgrade commands take no (package) arguments,
yet do not produce an error like others.
Regards
=== modified file 'cmdline/apt-get.cc'
--- cmdline/apt-get.cc 2013-04-08 13:38:45 +0000
+++ cmdline/apt-get.cc 2013-04-15 22:52:19 +0000
@@ -1845,6 +1845,9 @@
packages */
bool DoUpgrade(CommandLine &CmdL)
{
+ if (CmdL.FileSize() != 1)
+ return _error->Error(_("The upgrade command takes no arguments"));
+
CacheFile Cache;
if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
return false;
@@ -2178,6 +2181,9 @@
/* Intelligent upgrader that will install and remove packages at will */
bool DoDistUpgrade(CommandLine &CmdL)
{
+ if (CmdL.FileSize() != 1)
+ return _error->Error(_("The dist-upgrade command takes no arguments"));
+
CacheFile Cache;
if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
return false;
Reply to: