-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Add script to convert XXXerr() to XXXerror #9441
Conversation
Should there be underscore between MODULE and error to better align with other identifiers? Like BUF_error. |
I think this is much better. I do have a worry about the pain it will cause us when backporting fixes from master to 1.1.1. One option would be to do this - but delay it until shortly before we release 3.0. Or alternatively maybe it won't be so bad and we should just get on with it. I'm not sure. |
Travis failure is not relevant. |
I'm inclined to agree with @t8m that |
I'll wait a few days and see what the other committers and OMC think before I do more work on this. |
Added commit 08a88216176cc7fec454ebd3f1c4e87b15e51628 which includes the editing script and commit 14fb890f86926733a6b6d9f99d961650157aeb0e which shows what things look like using |
I agree with Tomas about undescore and Matt about delay. |
Since #9452 is likely to go in, I have removed variations and made this based purely on that. |
Taking this out of WIP. It is reasonable to do the conversion (very) late in the development cycle, so I made it easier to do so. This PR now adds the conversion script, and it shows how the old XXXerr defines will get deprecated, by a hack in err.h that should be removed then the script is run. |
I changed the title, removed the WIP. |
I'd appreciate feedback on the comments in the script, starting at around line 14 of https://github.com/openssl/openssl/pull/9441/files#diff-101f5c3e883943d0b61879f71fa9d71fR14 |
I added a script to merge |
I pushed another commit to reformat some code. When I do that, I can run the automated scripts and build without errors:
I think this PR, which does not do the big conversion should be reviewed and merged. And then, when the project team is ready, they can run the scripts to do the conversion and merge it. |
# define TSerr(f, r) ERR_raise_data(ERR_LIB_TS, (r), NULL) | ||
# define UIerr(f, r) ERR_raise_data(ERR_LIB_UI, (r), NULL) | ||
# define X509V3err(f, r) ERR_raise_data(ERR_LIB_X509V3, (r), NULL) | ||
# define X509err(f, r) ERR_raise_data(ERR_LIB_X509, (r), NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a little unnecessary to make them into ERR_raise_data
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's hidden behind a macro. If I leave it as ERR_raise
that will then get turned into ERR_raise_data
so I figured it was more useful to developers to not have to chase down multiple define's. But if you want it changed, okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(By which I mean, be expilcit and say "please change it" :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I only made a comment, not a change request. I'll try to remember to be explicit about that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a big deal; I think we sometimes forget that discussion is one of the most important things about a PR. :)
Related to #9333 (comment) this PR can be merged new, safely, and then the steps in #9441 (comment) can be done just before one of the pre-official releases. |
Actually, for transition, they're not really deprecated. Remove the "1 ||" from the ifdef line (in include/openssl/err.h) when ready to do this in production/"for real"
It either makes the flow of control simpler and more obvious, or it is just a "cleanup" so that the editing scripts will find and fixup things.
This is the infrastructure, and includes steps to do the work, for converting the old XXXerr calls. It's been a month. Ping for review. |
if (ret == -2) | ||
EVPerr(EVP_F_EVP_CIPHER_PARAM_TO_ASN1, ASN1_R_UNSUPPORTED_CIPHER); | ||
else if (ret <= 0) | ||
EVPerr(EVP_F_EVP_CIPHER_PARAM_TO_ASN1, EVP_R_CIPHER_PARAMETER_ERROR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for being out of context, but is it OK that here we leave EVPerr(), and in https://github.com/openssl/openssl/pull/9441/files#diff-9f773e58c4cc40339f694534e55f6cb3 we replace EVPerr with ERR_raise()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are changes are made to make life easier with util/merge-err-lines
, as that only handles this kind of split:
BLARGerr(BLARG_F_FOO,
BLARG_R_BAR);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
if (ret == -2) | ||
EVPerr(EVP_F_EVP_CIPHER_ASN1_TO_PARAM, EVP_R_UNSUPPORTED_CIPHER); | ||
else if (ret <= 0) | ||
EVPerr(EVP_F_EVP_CIPHER_ASN1_TO_PARAM, EVP_R_CIPHER_PARAMETER_ERROR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same answer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just made a test run, these scripts appear to do what they promise
Reviewed-by: Dmitry Belyavskiy <[email protected]> Reviewed-by: Richard Levitte <[email protected]> (Merged from #9441)
Actually, for transition, they're not really deprecated. Remove the "1 ||" from the ifdef line (in include/openssl/err.h) when ready to do this in production/"for real" Reviewed-by: Dmitry Belyavskiy <[email protected]> Reviewed-by: Richard Levitte <[email protected]> (Merged from #9441)
Reviewed-by: Dmitry Belyavskiy <[email protected]> Reviewed-by: Richard Levitte <[email protected]> (Merged from #9441)
It either makes the flow of control simpler and more obvious, or it is just a "cleanup" so that the editing scripts will find and fixup things. Reviewed-by: Dmitry Belyavskiy <[email protected]> Reviewed-by: Richard Levitte <[email protected]> (Merged from #9441)
THANK YOU! |
As discussed in the comment thread at #9391 (comment), this adds new XXXerror() defines that gets rid of the now-unused function name and deprecates the XXXerr() defines.
This is FYI to give a "taste" of what the conversion would be like. In numeric order, the ones remaining are shown below.
Does the OMC want to do this? If so, I'll continue with the conversion.