unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28446: linux-libre@4.1 should select 4.1.x, not 4.13.x
@ 2017-09-13 15:07 Mark H Weaver
  2017-09-21 12:48 ` Ricardo Wurmus
  0 siblings, 1 reply; 6+ messages in thread
From: Mark H Weaver @ 2017-09-13 15:07 UTC (permalink / raw)
  To: 28446

Currently, the package specification "linux-libre@4.1" selects version
4.13.  It should instead select version 4.1.

      Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#28446: linux-libre@4.1 should select 4.1.x, not 4.13.x
  2017-09-13 15:07 bug#28446: linux-libre@4.1 should select 4.1.x, not 4.13.x Mark H Weaver
@ 2017-09-21 12:48 ` Ricardo Wurmus
  2017-09-22  1:53   ` Chris Marusich
  2017-09-26  4:26   ` Mark H Weaver
  0 siblings, 2 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2017-09-21 12:48 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: 28446


Hi Mark,

> Currently, the package specification "linux-libre@4.1" selects version
> 4.13.  It should instead select version 4.1.

We consider everthing following the “@” a version string prefix.  Since
versions are arbitrary strings “4.1” is considered a valid prefix of
“4.13”.  If a user supplied the version string “4.1.” they would get the
appropriate package.

The current implementation sorts all matches in decreasing version order
and picks the package with the highest version.  This is implemented in
(gnu packages) with “%find-packages”, “find-best-packages-by-name”, and
“find-packages-by-name”.

Should we try to make the code understand version strings better and
compare substrings of the version string?  We could fall back to using
“string-prefix?” when the substring is not a number.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#28446: linux-libre@4.1 should select 4.1.x, not 4.13.x
  2017-09-21 12:48 ` Ricardo Wurmus
@ 2017-09-22  1:53   ` Chris Marusich
  2017-09-22  8:04     ` Ricardo Wurmus
  2017-09-26  4:26   ` Mark H Weaver
  1 sibling, 1 reply; 6+ messages in thread
From: Chris Marusich @ 2017-09-22  1:53 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 28446

[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]

Ricardo Wurmus <rekado@elephly.net> writes:

> Hi Mark,
>
>> Currently, the package specification "linux-libre@4.1" selects version
>> 4.13.  It should instead select version 4.1.
>
> We consider everthing following the “@” a version string prefix.  Since
> versions are arbitrary strings “4.1” is considered a valid prefix of
> “4.13”.  If a user supplied the version string “4.1.” they would get the
> appropriate package.
>
> The current implementation sorts all matches in decreasing version order
> and picks the package with the highest version.  This is implemented in
> (gnu packages) with “%find-packages”, “find-best-packages-by-name”, and
> “find-packages-by-name”.
>
> Should we try to make the code understand version strings better and
> compare substrings of the version string?  We could fall back to using
> “string-prefix?” when the substring is not a number.
>

Why not require an exact match?  If someone asks for 4.1, they shouldn't
get 4.11 or 4.13 or anything else; they should get 4.1.  In my
experience, mechanisms that attempt to guess which package version the
user meant generally wind up choosing the wrong thing at some point.  I
think it would be reasonable to bail out and ask the user to clarify
what they wanted.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#28446: linux-libre@4.1 should select 4.1.x, not 4.13.x
  2017-09-22  1:53   ` Chris Marusich
@ 2017-09-22  8:04     ` Ricardo Wurmus
  0 siblings, 0 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2017-09-22  8:04 UTC (permalink / raw)
  To: Chris Marusich; +Cc: 28446


Chris Marusich <cmmarusich@gmail.com> writes:

> Ricardo Wurmus <rekado@elephly.net> writes:
>
>> Hi Mark,
>>
>>> Currently, the package specification "linux-libre@4.1" selects version
>>> 4.13.  It should instead select version 4.1.
>>
>> We consider everthing following the “@” a version string prefix.  Since
>> versions are arbitrary strings “4.1” is considered a valid prefix of
>> “4.13”.  If a user supplied the version string “4.1.” they would get the
>> appropriate package.
>>
>> The current implementation sorts all matches in decreasing version order
>> and picks the package with the highest version.  This is implemented in
>> (gnu packages) with “%find-packages”, “find-best-packages-by-name”, and
>> “find-packages-by-name”.
>>
>> Should we try to make the code understand version strings better and
>> compare substrings of the version string?  We could fall back to using
>> “string-prefix?” when the substring is not a number.
>>
>
> Why not require an exact match?  If someone asks for 4.1, they shouldn't
> get 4.11 or 4.13 or anything else; they should get 4.1.

“4.1” has no exact match.  The full version string is “4.1.43”.  If we
want users to get “4.1.43” when they input “4.1”, then we’ll have to
make the code understand version strings better.

Not all version strings are dot-separated numbers.  Maybe this doesn’t
matter and we’ll just ignore those cases.

> In my
> experience, mechanisms that attempt to guess which package version the
> user meant generally wind up choosing the wrong thing at some point.  I
> think it would be reasonable to bail out and ask the user to clarify
> what they wanted.

The code already produces a warning in this case but proceeds to pick
the match with the highest version.

-- 
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#28446: linux-libre@4.1 should select 4.1.x, not 4.13.x
  2017-09-21 12:48 ` Ricardo Wurmus
  2017-09-22  1:53   ` Chris Marusich
@ 2017-09-26  4:26   ` Mark H Weaver
  2018-05-13 11:31     ` Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Mark H Weaver @ 2017-09-26  4:26 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 28446

Hi Ricardo,

Ricardo Wurmus <rekado@elephly.net> writes:

>> Currently, the package specification "linux-libre@4.1" selects version
>> 4.13.  It should instead select version 4.1.
>
> We consider everthing following the “@” a version string prefix.  Since
> versions are arbitrary strings “4.1” is considered a valid prefix of
> “4.13”.  If a user supplied the version string “4.1.” they would get the
> appropriate package.
>
> The current implementation sorts all matches in decreasing version order
> and picks the package with the highest version.  This is implemented in
> (gnu packages) with “%find-packages”, “find-best-packages-by-name”, and
> “find-packages-by-name”.
>
> Should we try to make the code understand version strings better and
> compare substrings of the version string?  We could fall back to using
> “string-prefix?” when the substring is not a number.

One possible approach would be as follows: if the last character of the
specification is a digit, then priority should be given to versions that
have a non-digit (or end-of-string) after the last matching character.

Put another way, if the provided specification {SPEC} ends with a digit,
then we should first search based on the following regexp:

  ^{SPEC}[^0-9]

if no matches are found, then fall back to:

  ^{SPEC}

This would gracefully handle the common case where groups of adjacent
digits should be considered as single numbers, while still allowing
prefixes of other numeric components such as dates or commit ids.

I admit that this proposal lacks elegance.  So far I have no better
ideas.

      Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#28446: linux-libre@4.1 should select 4.1.x, not 4.13.x
  2017-09-26  4:26   ` Mark H Weaver
@ 2018-05-13 11:31     ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2018-05-13 11:31 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: 28446-done

Hello,

Mark H Weaver <mhw@netris.org> skribis:

> Ricardo Wurmus <rekado@elephly.net> writes:
>
>>> Currently, the package specification "linux-libre@4.1" selects version
>>> 4.13.  It should instead select version 4.1.
>>
>> We consider everthing following the “@” a version string prefix.  Since
>> versions are arbitrary strings “4.1” is considered a valid prefix of
>> “4.13”.  If a user supplied the version string “4.1.” they would get the
>> appropriate package.

I pushed a fix that I think does what we want as
348987d3d12ebaf11fdbcc3dbd56585e7d69a1f5.

Basically ‘version-prefix?’ splits a version string at dots and compares
whole components.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-13 11:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-13 15:07 bug#28446: linux-libre@4.1 should select 4.1.x, not 4.13.x Mark H Weaver
2017-09-21 12:48 ` Ricardo Wurmus
2017-09-22  1:53   ` Chris Marusich
2017-09-22  8:04     ` Ricardo Wurmus
2017-09-26  4:26   ` Mark H Weaver
2018-05-13 11:31     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).