-
Notifications
You must be signed in to change notification settings - Fork 16
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
Review: extract versions more safely #1
base: master
Are you sure you want to change the base?
Conversation
karenetheridge
commented
Mar 15, 2014
- use code pioneered in https://github.com/dagolden/Version-Eval and updated by @haarg to extract versions more safely from .pm files
- there originally was a dependency on 5.008001; I removed this, but I am not sure if it is actually needed
(there are also some recent commits in master that could be looked at, although they should all be uncontroversial.) |
Passes its t/ tests on 5.6.2 |
Other than the one or two comments I made, I think it's reasonable, though it should stay -TRIAL for a while, I'm pretty sure. Side note: Andreas actually runs his separate process as another, restricted user as well. I don't think we need that, because a restricted user could be made to run M::M itself. |
cde0417
to
5f26c2a
Compare
I'm going to rebase this branch against the new master so it can be merged at QAH 2015 - I'm embarrassed that I've let this sit a whole year. |
26e2515
to
a1597b6
Compare
rebased to v1.000020 so far (a pristine copy of the PR is pushed to topic/safe_versions_orig) |
I've redone this PR on top of the new master, but tests are failing because the work failed to account for an API requirement that didn't have tests last year but is now being tested -- that the returned version must always be a version.pm object. Therefore we need another wrapper layer to sanitize the version returned by |
a1597b6
to
ac4436c
Compare
I'm pretty sure that not returning a version object was am intentional part of the changes here. I think we at least want to preserve that behavior under a different name. |
@haarg the path that I'm assuming presently is that Module::Metadata::ExtractVersion::eval_version should return, in string form, whatever it finds, but that Module::Metadata->new(...)->version(...) should continue to return a version object. It may make sense to create new internal hash keys to store the original stringy form, as they may not convert to a version object without further sanitization. |
...however, we may want to switch the public API to returning strings?... which would need more discussion as well as thorough testing :) |
Generally I think it makes sense for the API to return the same form that exists in the file, which could be a string or a version object. |
I think that depends on the purpose. For display, a string is fine. For
|
…jects (not yet exposed as an API)
ac4436c
to
9083544
Compare
Force-pushed with some cleanup commits inserted prior to these changes, which extract the raw version string separately and then inflate it to a version object, as we were doing before. Now there is just one test failure (my debugging output included):
In master, the test looks like this:
|
This test does not pass because the operation is not permitted: However I'm going to have to back up again and write tests for both the raw version as well as the final (version.pm-inflated) version, to be sure we aren't regressing there in relation to master. FML :( |
f32f0dc
to
669d23b
Compare