#742611 apt-cache: showsrc non-existent returning 0

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Maximiliano Curia
Date:
2015-04-29 21:03:09 UTC
Severity:
normal
#742611#5
Date:
2014-03-25 13:32:08 UTC
From:
To:
Hi,

apt-cache showsrc non-existent shows a W and a N message and returns 0, while
apt-cache show non-existent shows a W and an E message and returns 100.

The show approach makes it easier for scripts that rely on apt-cache, so I'm
attaching a simple patch for showsrc for this.

Thanks,
- -- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.14-rc7-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages apt depends on:
ii  debian-archive-keyring  2012.4
ii  gnupg                   1.4.16-1.1
ii  libapt-pkg4.12          0.9.16.1
ii  libc6                   2.18-4
ii  libgcc1                 1:4.8.2-17
ii  libstdc++6              4.8.2-17

apt recommends no packages.

Versions of packages apt suggests:
ii  apt-doc     0.9.16.1
ii  aptitude    0.6.10-1
ii  dpkg-dev    1.17.6
ii  python-apt  0.9.3.4
ii  synaptic    0.81

- -- no debconf information
iQIcBAEBCAAGBQJTMYU5AAoJEMcZdpmymyMqWwQP/Rkg4Jz3PtBWE+fjVrntnpdf
jar+BGAaZV54vGMI+YCjBv+yXNXedO3pJgNQXnxyPW0bezB4cVv1hCoX5fpv7d7e
kYzc0KyLnTwMqqYBcr+MB8ayvLxdsm9WDgo+rh4TgWKRBlaNp2MViHvMRSjCcE2i
FC1FrslWHKkAAWSpga902rjhxdp3+nmHLhRbMrEO1UrgCYPn4AKl6/Q8FZoMkrEV
jA6QJQ9csl3wBljkoXdh+FSxyKLlmZURrQr57mO4YzJ0XVj8IgCZrGL77q87MJlC
FTwSNXunh0ubPp4DVUNeFJ9dX798e5C8rCPfMKROli11NhbTNJuFyEE9nEJKFUPr
lBk+xjW0u+zC0gIIhjYiKRqFEGSL6uUO6RmZqkTV8st0ZitnQF7NlQNC7nyiLesS
gpvSVpqKmnRY5YIGaoUswmSUdZvH7uVe8gdLeFlP3L3k7Hm/ZtqQREesXvO0IfSr
7n6Ul5SJYwv7o+Z0peCQqELUdXA5viNprMTOLeILCNsCedOP0YwYPnkNl/78Uidb
FogRc1wRa9Gv1XFUjwSjHOQ1uKH4gt1ZzAvlVknfcNR6kWyJ7wt2BRxzqOCx27zP
d9vYLq57MIT0EfYS7M7ug+/y6qCQuhAki5i5szoTqOC637K7AQtAEMdwPZWT+mdi
AgL9Ls+Gv4hfO/GqK9jQ
=8HFg
-----END PGP SIGNATURE-----

#742611#10
Date:
2014-03-26 15:38:13 UTC
From:
To:
Hi,
and it tells me two things:
Mar 2010: Change behavior of showsrc to match the one of show by Julian
 (aka: show a message at all!)
Jul 2010: downgrade from Error to Notice by me
 (which btw is also the case for show if you happen to provide a
  virtual package for the following reasons – consistency for the win!)

The later is part of a series of commits downgrading Errors to Notices
(again), because we uncovered that e.g. sbuild and launchpad were
falling over these changes. I haven't checked if this is still the
case, but I tend to assume the answer is yes. I guess a code search
would uncover a billion other cases, just like it is the case in terms
of surprises you get while searching for 'sources.list' "parsers"…


So while this would make sense, we hadn't the energy to push this hard
enough. I guess a plan would be to:
1. add an option (default disabled) to promote them to errors again
   ( -o apt::some::thing=true/false can be added at will )
2. change sbuild, launchpad, … to use this option if needed
3. change the default of the option to enabled
4. add the option to all the software forgotten in 2.

I would accept a patch for 1. in jessie, so that if all known things in
2. can get fixed (one way or the other) to cope with 3. in jessie+1, but
that needs someone who wants to work on it… volunteers?


Best regards

David Kalnischkies

#742611#15
Date:
2014-09-23 14:45:47 UTC
From:
To:
¡Hola David!

El 2014-03-26 a las 16:38 +0100, David Kalnischkies escribió:

I've prepared another patch that adds the config option.

Care to review it?

Happy hacking,

#742611#20
Date:
2014-10-01 19:55:05 UTC
From:
To:
Hello,

Thanks for picking it up & sorry, I meant to reply earlier…

I guess for uniformity the config option should be named
"APT::Cache::ShowSrc::ErrorOnNotFound" as it is written as an option
specific to showsrc.

I would be more happy if it would be a more general option and in fact
"reverts" cd7bbc479f8e2f277092a9557bb486ab664deba6.  Although, now that
I am looking, this commit actually doesn't include showsrc as CacheSets
are limited to binary packages/versions.

Anyway, a new option should really have some documentation, aka
a sentence or two in doc/apt-cache.8.xml.


Best regards

David Kalnischkies

#742611#25
Date:
2015-04-29 20:51:37 UTC
From:
To:
¡Hola David!

El 2014-10-01 a las 21:55 +0200, David Kalnischkies escribió:

Ok, I made it a non showsrc specific option, doing the suggested "revert", so
that the errors are ERROR instead of NOTICE if the option
APT::Cache::FailOnErrors is set. But I don't fully understand the overall code,
so there it might be an obvious NOTICE that should stay as such that I haven't
taken into account.

So please review it thoroughly.

Added. Would it worth adding it to the synopsis?

Happy hacking,