Remove func name from errors, etc.#9058
Remove func name from errors, etc.#9058richsalz wants to merge 2 commits intoopenssl:masterfrom richsalz:remove-func-name
Conversation
|
-1 so we can take this to a vote for a decision on this change |
|
See also #1415. We did this in BoringSSL years ago. It's worked out very well. In practice, anyone using these were doing so incorrectly. It reduces binary size, reduces maintenance effort, and avoids a large class of backwards compatibility issues where callers incorrectly depend on function codes and break as code moves around internally. |
|
I think its a good idea - the removed value seems to convey very little. |
|
You have left the function stuff in place for the SYSerr level - so there are still SYS_F_ usages in place. |
|
I kept those because in this case it shows the actual syscall that failed. If you (or the OMC since you moved for a discussion/vote), prefer that I get rid of them I will. I suppose, pedantically, the right thing to do is to call ERR_add_error_data with the true syscall name, which I can also do if the OMC wants. |
|
Also, if the OMC wants to move forward on this, I would be willing to edit all XXXerr functions to remove the |
|
I'm actually unsure how interesting it is to encode what syscall returned with an error. Isn't the error itself the interesting part? If, say, if ((fd = open("foo.txt", O_CREAT)) < 0)
perror("Can't create \"foo.txt\"");or like this? if ((fd = open("foo.txt", O_CREAT)) < 0)
perror("open() doesn't let me create \"foo.txt\"");If we feel the need to display the syscalls that were the origin of an error, maybe that's an indication that would could provide better error messages to start with? Also, if we absolutely feel the need and go with an error call like |
|
* I'm actually unsure how interesting it is to tell what syscall returned with an error.
I guess you folks need to decide. I agree with @t-j-h and find it useful.
|
Not sure what you agree with... the way I read his input was just a state of fact that your works appears incomplete. |
|
@levitte, I re-read things and you are right that I misunderstood @t-j-h 's comment. Unlike other errors however, the And, having written this long and detailed paragraph, of course it belongs over in #9072 but hopefully adding the link will suffice. :) |
|
Is anyone on the OMC going to move forward with a discussion/vote on this, or should I close it? |
|
I just started the discussion |
|
It's been a month since @t-j-h placed the hold/-1 on this. It seems to have been two weeks since there was discussion on the openssl-project mailing list (https://mta.openssl.org/pipermail/openssl-project/2019-June/001451.html) Does the @openssl/omc have any plan of action? If there is no other activity on this topic, I will close this PR and delete the branch next week. I'm fine with that, but I'm not fine with doing the exercise of rebasing all the time if nothing is going to happen. |
|
That thread is quite long, and I'd like to catch up with it before commenting here (been away for more than a week, I've forgotten things). This PR is only part of the stuff that needs to happen, if any at all. |
|
I think removing the function id is a positive change. |
Well, not much that affects this PR per se... we did talk about extending the debug information surrounding an error in that thread, but that should probably be subject for another PR. |
crypto/err/err.c
Outdated
There was a problem hiding this comment.
We should actually use this more, not take it away...
There was a problem hiding this comment.
This is a clean-up PR, so leaving something that's never used anywhere in the code seems like a mistake.
There was a problem hiding this comment.
This is a function code removal PR, at least according to its description.
There was a problem hiding this comment.
I still want you to undo this...
crypto/err/err.c
Outdated
There was a problem hiding this comment.
Any reason why you're removing this?
There was a problem hiding this comment.
I too was kind of surprised that this isn't used anywhere, but it isn't so as part of this cleanup PR I removed it.
crypto/err/err.c
Outdated
There was a problem hiding this comment.
I still want you to undo this...
crypto/err/err.c
Outdated
|
If the vote passes I'll make additional changes. |
|
Ok. I'll just note that other than the few nits, this PR looks good to me. |
|
I think the defines should stay in the public headers for now, should get deprecated, and can all be changed to the value 0. |
|
@kroeckx is your comment at #9058 (comment) enough to clear your -1/hold? Or do we still need to wait for the vote. If I change mkerr to output zero-valued |
|
It's @t-j-h that put this PR on hold. (I did this for #9082, you didn't reply to my last comment.) A vote related to this PR has been called, and is still open. I think it's unclear what the vote really is about, since it actually mentions the PR rather than what you want to achieve. But I think the intention of the vote is for removing the function names from the errors, not on how it's implemented. (I wish people would actually discuss what we voted on before calling a vote to prevent such unclear votes.) So my comment is about the implementation. If you want, you can consider that a -1 on the implementation that goes away when you make that change. |
The vote is ongoing, we do need to wait for it either way. |
I think that's what @kroeckx suggests. "should get deprecated" looks clear to me. |
Uhmmmm, but there was a discussion... the vote even links to it. However, mental note made, clearer vote text requested. |
Deprecate all xxx_F_ defines. Removed some places that tested for a specific function. Use empty field for the function names in output. Update documentation. Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Richard Levitte <[email protected]> (Merged from #9058)
Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Richard Levitte <[email protected]> (Merged from #9058)
|
So should we do the following from now on? |
|
Yes, that's the idea |
|
Defining all these existing macros to zero and also returning zero as the value of the function value means anyone checking function codes will end up getting false matches once this change is in place. |
For ones that are new, is it worth dropping the first argument? |
Considering the function codes set were a moving target anyway, that risk was tangible either way. |
So uhmmm, a new name for all, basically? |
|
Not for all: |
|
Adding multiple names is a bad idea; the API surface of OpenSSL is already huge. Wait until the next major release and rewrite the macros to just drop the argument. |
|
I dont see any problem with removing it from Proverr which has never been released |
|
Good point |
|
Pleased to see that some simplifications are in progress that will remove redundancy w.r.t. function names and thus the need to keep function names and function code identifiers consistent. Shouldn't also |
|
We're keeping the function codes for 3.0 for backward compatibility. Next release they could be removed; see the TODO comment in util/mkerr.pl |
|
I see. So until then, when adding, removing, and renaming functions, one still needs to keep the related function code identifiers in crypto/err/openssl.txt, crypto/*/*err.c, and include/openssl/*err.h in sync. In particular, when renaming functions that include *err() calls, one still must manually adapt those files (since |
|
I think it would be easy to change mkerr so that it didn't complain about mismatched function names; would that address your comment? |
|
New code can simply avoid the function macro completely. FOOerr(0, FOO_R_REASON);(this has been possible since 1.1.0, I might add) |
|
Why isn't the function argument just removed from the call?
|
|
I guess to make backporting easier?
|
It's a macro in a public header file, someone may be using it, so we kept it for compatibility for this release, just like we kept the |
|
Very glad to learn that for new code one can simply replace the function code identifier argument by 0 in FOOerr(...) calls! So we'll do that for our CMP contribution at least for the current chunk 4 and all further ones. |
This removes the function names from error messages. (There is some discussion of this in #9003.)
There are two commits. The first is all the code changes, the second is the result of doing a force-rebuild of the errors (
make ERROR_REBUILD=-rebuild errors) to update the header files and error tables. (UPDATE 3 July: there are three commits, one removes unused reason codes.)For idle minds, this removes nearly 7400 lines. Comparing "no-shared" versions of openssl:
Which saves a surprising 75K (1.5%)!