Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 340321 - dev-java/java-config-2.1.11: VersionManager.package_parser parses atoms incorrectly
Summary: dev-java/java-config-2.1.11: VersionManager.package_parser parses atoms incor...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Java team
URL: http://overlays.gentoo.org/proj/java/...
Whiteboard:
Keywords: Inclusion
Depends on:
Blocks:
 
Reported: 2010-10-10 10:43 UTC by Martin von Gagern
Modified: 2013-02-02 19:45 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Proposed quick fix (gentoo340321.patch,718 bytes, patch)
2010-10-10 10:44 UTC, Martin von Gagern
Details | Diff
Improved fix (gentoo340321b.patch,1.88 KB, patch)
2010-10-10 13:27 UTC, Martin von Gagern
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2010-10-10 10:43:13 UTC
This bug was discovered while investigating bug #161622 comment #30.
$ depend-java-query --get-vm '>=virtual/jdk-1.4 >=dev-java/jdbc-mysql-3.1'
does not list a java 1.6 jm as required by dev-java/jdbc-mysql-5.1.11.
The reason is that the package_parser regular expression as added in http://overlays.gentoo.org/proj/java/changeset/7929 does parse that atom as "dev-java/jdbc-mysql-3". The digit 3 does match \w, but the . isn't matched.
Comment 1 Martin von Gagern 2010-10-10 10:44:53 UTC
Created attachment 250099 [details, diff]
Proposed quick fix

This is a quick fix for the issue. Nevertheless I suggest someone get together with the portage development team or EAPI group and figure out a reliable regexp to match Gentoo package atoms. Despite my expectations I couldn't find such a regexp in the portage source code, at least not as easily as I had hoped.
Comment 2 Martin von Gagern 2010-10-10 13:27:13 UTC
Created attachment 250115 [details, diff]
Improved fix

I meant PMS, not EAPI, in comment #1. For details about the PMS document I reference below, see http://www.gentoo.org/proj/en/qa/pms.xml

The regexp in the attached patch should resemble the PMS 3 specification more closely. It does, however, reject packages with a name ending in a hyphen, and doesn't model the relation between operators and the presence or absence of version numbers. Adding that would make the regexp even larger.

In the long run, it might be a good idea to stop silently ignoring any part of the atoms string we cannot parse. Instead it might be better to split atoms and ensure we parse each of them completely, issuing a warning if we fail for any of them. Parsing atoms completely would allow regexps to enable backtracking, which would allow us to accept hyphens at the end of a package name. Currently, allowing a hyphen at the end of the package name will greedily consume the version delimiter, ending the match at the first digit of the version number.

The regexp for package names resulted from the following interpretation based on section 3.1.2 (Package Names) of PMS 3:
* >= 2 characters, not ending in a digit (here's the ending hyphen)
  [A-Za-z0-9+_][A-Za-z0-9+_\-]*[A-Za-z+_\-]
* >= 3 characters, ending in a digit
  [A-Za-z0-9+_][A-Za-z0-9+_\-]*[A-Za-z+_][0-9]+
* == 1 character
  [A-Za-z0-9+_]
* == 2 characters, ending in a digit
  [A-Za-z0-9+_][0-9]
Comment 3 Martin von Gagern 2011-09-14 08:09:22 UTC
Ping? This has been almost a year!
Comment 4 Cyprien Nicolas (fulax) 2013-02-02 19:45:54 UTC
I saw something similar when trying to port an ebuild using java-pkg-opt-2.eclass to Prefix. Not sure where the root cause is.