Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 70416

Summary: portage considers versions '042' and '42' unequal
Product: Portage Development Reporter: Donnie Berkholz (RETIRED) <dberkholz>
Component: Core - Ebuild SupportAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: High    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 147007    
Attachments: change match_from_list to use vercmp() for all operators

Description Donnie Berkholz (RETIRED) gentoo-dev 2004-11-07 22:22:09 UTC
For example, emerge =udev-42 fails, while emerge =udev-042 works. They are clearly the same number.
Comment 1 Jason Stubbs (RETIRED) gentoo-dev 2004-11-07 22:32:42 UTC
This is by design it seems as the there is code to explicitly prevent 042 and 42 from being equal. It is most likely that way to ensure that two different version strings never resolve to the same numeric version.

However, after looking at the code, it seems to be flawed. While the code does keep 042 and 42 different, it seems to make 042 and 0420 the same.
Comment 2 Donnie Berkholz (RETIRED) gentoo-dev 2004-11-07 22:47:18 UTC
They really shouldn't be different in this world. Any number prefaced by any number of zero's should resolve to the original number.
Comment 3 Marius Mauch (RETIRED) gentoo-dev 2004-11-08 13:29:27 UTC
I assume this was coming from the 1.023 != 1.23 requirement. Offhand it looks to be fixed (= first version number component is special) in my rewrite in bug 37406.
Comment 4 Marius Mauch (RETIRED) gentoo-dev 2006-04-04 11:58:17 UTC
Donnie, can you confirm that it's fixed in 2.1?
Comment 5 Donnie Berkholz (RETIRED) gentoo-dev 2006-04-04 12:16:17 UTC
No, it's not fixed in 2.1_pre6-r5.

donnie@supernova ~ $ emerge -vp =udev-89

These are the packages that would be merged, in order:

Calculating dependencies
emerge: there are no ebuilds to satisfy "=udev-89".
Comment 6 Marius Mauch (RETIRED) gentoo-dev 2006-04-04 18:30:59 UTC
Created attachment 83942 [details, diff]
change match_from_list to use vercmp() for all operators

Ok, it's a bit more subtle than I thought. If you check you'll notice that it works for the range operators (>, <, >=, <=) but not for =, ~ or =*, as those don't rely on vercmp for equality checks but use string comparison.

The attached patch changes the relevant match_from_list function to always use vercmp(), so it should solve your problem, please confirm (should apply on any 2.1 portage, and maybe even on 2.0).
Comment 7 Zac Medico gentoo-dev 2007-01-11 04:15:10 UTC
This is in svn r5510:5521 and released in 2.1.2_rc4-r8.