[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#700116: apt-cache silently ignores -t



Hello

On 9 February 2013 06:31, Russ Allbery <rra@debian.org> wrote:
> Package: apt
> Version: 0.9.7.7
> Severity: normal
>
> One gets into the habit of using -t to select the distribution when
> doing various apt-related things, but apt-cache doesn't support it.
> It would be nice if it did, but failing that, it would be nice if it
> produced an error.  Right now, running:
>
>     apt-cache -t unstable show webauth-utils
>
> just quietly ignores the -t option.

This is a somewhat common misconception caused by an improper
understanding of the role of -t.  I am not sure where such
misunderstanding originates from as the manual is clear that it
has a particular role within an algorithm documented by
apt_preferences(5).  Anyway, I'm sure you are aware of that.

It affects APT::Default-Release, exactly like other commands.  If you
use this with “policy” for example you will see it's impact.  This is
not expected to have an influence on an otherwise default invocation
of “show”; from the manual:

       -a, --all-versions
           Print full records for all available versions. This is the
           default; to turn it off, use --no-all-versions. If
           --no-all-versions is specified, only the candidate version
           will displayed (the one which would be selected for
           installation). This option is only applicable to the show
           command. Configuration Item: APT::Cache::AllVersions.

Even with --no-all-versions the /candidate version/ may not be from
the specified default release.  The correct syntax to select from a
particular release is “pkg/release”:

  $ apt-cache show webauth-utils/unstable

> The specific case that happened
> today was that someone did this on a system that didn't have unstable
> in sources.list and then got very confused by output from testing,
> thinking that it was from unstable since they specified unstable on
> the command line.

I have seen several bug reports where people have confused the
function of APT::Default-Release (-t) with “an instruction that the
packages be taken from release Foo.”  This is not the case.
Default-Release operates as per apt_preferences(5) and it is not an
explicit instruction to act on packages from a particular release.

In most cases the reporter actually wanted to use the pkg/release
syntax and had no issues learning about it.

Personally, I find that the manuals are clear enough and consistent in
their use of very particular terms (such as “candidate version”).
This facilitates the careful reader who does not make assumptions.
The documentation of -t in apt-get(8) does not particularly mislead
about the options role, though perhaps a short note there — for users
who do not also read apt_preferences(5) — that it is *not* equivalent
to the “pkg/release” syntax:

> … In short, this option lets you have simple control over which
> distribution packages will be retrieved from /but it is not
> equivalent to the more strict mechanisms for selecting specific
> package versions documented under the "install" action./ …

Perhaps otherwise a general discussion on specifying versions
(“=ver” and “/release”) rather than embedding this within the
instructions for “install”.

Regards


Reply to: