Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize duplicate conflicting versions #9

Closed
stof opened this issue Jan 27, 2015 · 13 comments
Closed

Optimize duplicate conflicting versions #9

stof opened this issue Jan 27, 2015 · 13 comments
Assignees

Comments

@stof
Copy link
Contributor

stof commented Jan 27, 2015

When a package has several vulnerabilities, the generated conflict constraint may be much more complex than necessary. See for instance the rule for FOSUserBundle (much simpler than the symfony one):

>=1.2.0,<1.2.1|>=1.2.0,<1.2.4|>=1.2.0,<1.3.0|>=1.3.0,<1.3.5|>=1.2.0,<1.2.5|>=1.3.0,<1.3.3

The third constraint is a superset of the first 2 ones (and of the 5th one). Deduplicating constraints would make the dependency resolution much easier for Composer later.

@stof
Copy link
Contributor Author

stof commented Jan 27, 2015

Note that in this case, it should be generated as >=1.2.0,<1.3.0|>=1.3.0,<1.3.5, or >=1.2.0,<1.3.5

@Ocramius
Copy link
Member

Considered that, but didn't yet start working on a normalizer for version constraints.

@reiz
Copy link

reiz commented Mar 17, 2015

@Ocramius Not much I can say to that one. We parse that kind of expressions at VersionEye but we do not normalise them. Our algorithm takes a set of all versions from the package, evaluates each expression sequentially and skips versions after each expression. The algo. ends up with a small subset of versions and from that one we take the newest.

In general I don't like such expressions. But currently I have no better idea :-/

@Ocramius
Copy link
Member

@reiz no problem, thanks for the input anyway :-)

@beberlei
Copy link

beberlei commented Sep 1, 2015

@Ocramius i think a simple way would be to partition into buckets by exact min version and then find the max version in that bucket and drop all the others.

@Ocramius
Copy link
Member

Ocramius commented Sep 1, 2015

@beberlei that's a good first optimization step, yes

@Ocramius
Copy link
Member

Ocramius commented Sep 1, 2015

For now, I could build something around an opinionated parser that assumes http://regexper.com/#%2F%3E%28%3D%29%3F%28\d.%29*\d%2C%3C%28%3D%29%3F%28\d.%29*\d%2F or ignores everything

Together with this opinionated horror: https://3v4l.org/rb94f

@lyrixx
Copy link

lyrixx commented Sep 1, 2015

I'm pretty sure @hoaproject has something for that.

@stof
Copy link
Contributor Author

stof commented Sep 1, 2015

@Ocramius take care of the case of constraint without a lower bound (to indicate that all older versions are affected). this is possible in the advisory database.

@Ocramius
Copy link
Member

Ocramius commented Sep 2, 2015

I produced a first prototype in #13. If you are interested, please do review. It doesn't cover open ended ranges yet.

@Seldaek
Copy link

Seldaek commented Sep 2, 2015

Just in case it helps, we have composer/semver as a standalone bit now, with some utilities to parse/match stuff. I kinda doubt it is of much help for the problem at hand though.

@Ocramius
Copy link
Member

Ocramius commented Sep 2, 2015

@Seldaek that's the same stuff we wanted to patch for this sort of issue :P (the stuff you mention in your keynote, remember?)

I think we will be fine with an opinionated matching for another 3~4 years here /cc @asgrim

asgrim added a commit that referenced this issue Sep 2, 2015
@Ocramius
Copy link
Member

Ocramius commented Sep 2, 2015

Closed via #13

@Ocramius Ocramius closed this as completed Sep 2, 2015
@Ocramius Ocramius self-assigned this Sep 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants