Bug#861742: apt-cache showsrc reports errors for additional successful source package results
Package: apt
Version: 1.4.1
apt-cache showsrc reports errors for every additional successful source
package result.
For example:
# LANG=C apt-cache showsrc xmms2-plugin-id3v2 xmms2-plugin-mad
xmms2-plugin-vorbis > /dev/null
W: Unable to locate package xmms2-plugin-mad
W: Unable to locate package xmms2-plugin-vorbis
The source package for both xmms2-plugin-mad and xmms2-plugin-vorbis are
indeed found, but it has found while searching for xmms2-plugin-id3v2.
The source package for all three xmms2-packages is the same: xmms2. For
xmms2-plugin-id3v2 it finds "xmms2"
as source and for rxmms2-plugin-mad it finds "xmms2" - which is already
a valid result in
the "seen" hash list. Therefore the resulting "xmms2" for
xmms2-plugin-mad and xmms2-plugin-vorbis
gets ignored, which results in an "unable to locate... " error message
even it's indeed already
"located".
A possible fix would be:
###############
--- apt-1.4.1/apt-private/private-show.cc 2017-04-24
18:47:55.000000000 +0200
+++ apt-1.4.1+nmu1/apt-private/private-show.cc 2017-05-03
12:05:10.120323617 +0200
@@ -336,12 +336,12 @@ bool ShowSrcPackage(CommandLine &CmdL)
if (_config->FindB("APT::Cache::Only-Source", false) == true)
if (Parse->Package() != *I)
continue;
+ found = true;
+ found_this = true;
std::string sha1str = Sha1FromString(Parse->AsStr());
if (std::find(seen.begin(), seen.end(), sha1str) ==
seen.end())
{
std::cout << Parse->AsStr() << std::endl;;
- found = true;
- found_this = true;
seen.insert(sha1str);
}
}
###############
... unaudited. Please review this patch; maybe only one of those result
lines has to be moved!
And please - fix the coding style. Not only within private-show.cc but
also with other apt source files.
It's heavily mixed with tabs and spaces and quite ugly with tabstop!=8.
Please, use either tabs _or_ spaces, but not both.
Regards
Michael
Reply to: