[Aptitude-devel] Bug#691531: Bug#691531: aptitude: search query ?any-version(~Atesting) doesn't work as expected

Manuel A. Fernandez Montecelo manuel.montezelo at gmail.com
Sat May 14 16:13:10 UTC 2016


Control: severity -1 minor
Control: tags -1 - confirmed + pending


Hi,

2012-10-27 05:36 Daniel Hartwig:
>Control: tags -1 + confirmed
>
>On 27 October 2012 04:10, Samuel Bronson <naesten at gmail.com> wrote:
>> My understanding is that ?any-version(<pattern>) is supposed to match
>> *all* versions of any package which has *any* version matching
>> <pattern>, but this is not what I've been getting; for example:
>
>That is the description of “?widen” (match all versions), not
>“?any-version” (match packages).  These are similar, the subtle
>difference may sometimes impact the results of combining search terms,

The documentation says:

  ?any-version(pattern)

  Matches a package if any one of its versions matches the enclosed
  pattern.  This is the dual to ?all-versions.

  This term may not be used in a context in which the versions to match
  against have already been narrowed, such as within ?depends or
  ?narrow. However, it may always be used within ?widen.

  Note

  This term is closely related to ?narrow. In fact,
  ?any-version(pattern1 pattern2) is exactly the same as
  ?narrow(pattern1, pattern2).


So it works as documented, and narrows the search.

There's a slight ambiguity in the first phrase, as if a "package" is
returned in case that any version matches, when it's "[package]
versions" which are "returned".


>though it should not in this case:
>
>>
>> naesten at hydrogen:~/hacking% aptitude versions '?exact-name(apt)'
>> i A 0.9.7.5                                       testing                   990
>> p A 0.9.7.6                                       unstable                  500
>> naesten at hydrogen:~/hacking% aptitude versions '?exact-name(apt)?any-version(~Atesting)'
>> Package apt:
>> i A 0.9.7.5                                       testing                   990
>>
>> I would expect to get the same results for both queries (there will
>> always be a version of "apt" in testing, right?), but I do not.
>
>so I agree that there is a bug here.

I don't agree that there's a bug.

'?any-version(~Atesting)' matches only those package-versions which have
any version in testing, '?exact-name(apt)' restricts that to those
versions matching the name.  Since both are used in combination and in
the context of the "versions" command, there's the confusion that it
should match all versions of packages for which any-version is in
testing, but this is just that, a misinterpretation.


Another similar test is if one matches packages (package-versions)
starting with "^apt" (including apt-listchanges, aptitude and others)
and then only those with a version of experimental, in which apt and
apt-listchanges have versions but which aptitude and many others
starting with "apt" do not.

The "search" command will do the correct and expected (as in the
original report) thing here, because only one version is shown at a time
anyway, so it will only list those packages (again, package-versions)
which have versions in experimental (e.g. apt and listchanges, but not
aptitude).

The "versions" command will show also the package versions that match,
not all versions of the packages for which one version matches.

>From the manpage, "versions":

  If a package name contains a tilde character (“~”) or a question mark
  (“?”), it will be treated as a search pattern and all matching
  versions will be displayed (see the section “Search Patterns” in the
  aptitude reference manual). This means that, for instance, aptitude
  versions '~i' will display all the versions that are currently
  installed on the system and nothing else, not even other versions of
  the same packages.

So "?any-version" matches versions of packages in which "any-version"
matches something, in this case being released in testing / experimental
/ etc.  With ~i shows only the versions which are installed, etc; and
with "?any-version(~i)" the same.


I can see how it can be interpreted as the original bug submission in
that context, that it "widens" the matches and that the "versions"
command should show all versions of the packages for which any version
is in testing, but this is not so (search patterns work with
package-versions, not "packages"), and the rest of the documentation is
quite clear about this.

So I am going to change the description of ?any-versions to clarify this.


>Note that “?widen(~Atesting)” achieves the desired result.

Example: aptitude versions '?widen(?exact-name(apt)?any-version(~Atesting))'


Cheers.
-- 
Manuel A. Fernandez Montecelo <manuel.montezelo at gmail.com>



More information about the Aptitude-devel mailing list