Skip to content

Add ERR_add_platform()#9072

Closed
richsalz wants to merge 3 commits intoopenssl:masterfrom
richsalz:add-err-platform
Closed

Add ERR_add_platform()#9072
richsalz wants to merge 3 commits intoopenssl:masterfrom
richsalz:add-err-platform

Conversation

@richsalz
Copy link
Contributor

@richsalz richsalz commented Jun 4, 2019

This is related to #9058 (comment) and also a bit to #8887. If the OMC decides to remove the function name from error codes, as that comment thread points out, it is still useful to report what function failed if it's something on the platform; e.g., "gethostbyname" failed, or what have you. This PR enables that. It adds a new function, ERR_add_platform which takes a string name for the platform-provided function that failed, and reports that as "extra data" in the error stack. All the SYS_F_xxx values are gone.

@beldmit
Copy link
Member

beldmit commented Jun 4, 2019

Strongly support this idea.
Maybe it makes sense also to provide errno when possible?

@slontis
Copy link
Member

slontis commented Jun 4, 2019

travis has docnits error

@richsalz
Copy link
Contributor Author

richsalz commented Jun 4, 2019

As the author of doc-nits I hang my had in shame.

Then I lift my head, do a fix, and push a new commit.

I should probably write a test, too.

@richsalz
Copy link
Contributor Author

richsalz commented Jun 4, 2019

@beldmit I thought about always adding errno, but for some platforms it's not always errno, but WASsocketerror, and it's up to the caller to do the right thing.

@richsalz
Copy link
Contributor Author

richsalz commented Jun 4, 2019

Added a test.

@richsalz
Copy link
Contributor Author

This has a test, travis should be okay, and it's rebased. Ping for reviews.

@levitte
Copy link
Member

levitte commented Jun 12, 2019

I find the new name non-intuitive. How about ERR_put_func_error?

@richsalz
Copy link
Contributor Author

Okay. Rename commit pushed.

@richsalz richsalz changed the title Add ERR_add_platform Add ERR_add_platform() Jun 18, 2019
@richsalz
Copy link
Contributor Author

weekly bump

@richsalz
Copy link
Contributor Author

1.5 fortnights. ping.

@richsalz
Copy link
Contributor Author

Rebased and force-pushed. Now that #9058 has been merged, I think this becomes even more useful, being able to say what (C runtime, usually) function failed. It improves our error messages. As far as I know, there are no open issues with this PR.

@t8m
Copy link
Member

t8m commented Jul 16, 2019

Unfortunately this is API break - you cannot change the meaning of the SYSerr argument as that is a public header macro. The workaround is to add a new macro and use it instead of SYSerr.

@richsalz
Copy link
Contributor Author

richsalz commented Jul 16, 2019 via email

@richsalz
Copy link
Contributor Author

richsalz commented Jul 17, 2019 via email

Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I slightly dislike the FUNCerr name as it looks quite generic and something that could collide with other code but as that is a bikesheading nitpick I approve anyway.

@paulidale
Copy link
Contributor

@t8m this improves the case for new names for the error raising functions.....

@richsalz
Copy link
Contributor Author

FUNC because of #9072 (comment) :)

@richsalz
Copy link
Contributor Author

Travis failure is a time-out, unrelated to this. This seems ready to merge now.

richsalz added 3 commits July 18, 2019 20:21
Change SYSerr to have the function name; remove SYS_F_xxx defines
Add a test and documentation.
Use get_last_socket_err, which removes some ifdef's in OpenSSL code.
@t8m
Copy link
Member

t8m commented Jul 22, 2019

Merged with conflict in libcrypto.num resolved.
56c3a13 Add ERR_put_func_error, and use it.
46160e6 Deprecate SYSerr, add new FUNCerr macro
a80278b Include deprecated SYS_F_xxx codes

@t8m t8m closed this Jul 22, 2019
levitte pushed a commit that referenced this pull request Jul 22, 2019
Change SYSerr to have the function name; remove SYS_F_xxx defines
Add a test and documentation.
Use get_last_socket_err, which removes some ifdef's in OpenSSL code.

Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Richard Levitte <[email protected]>
(Merged from #9072)
levitte pushed a commit that referenced this pull request Jul 22, 2019
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Richard Levitte <[email protected]>
(Merged from #9072)
levitte pushed a commit that referenced this pull request Jul 22, 2019
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Richard Levitte <[email protected]>
(Merged from #9072)
@richsalz richsalz deleted the add-err-platform branch July 22, 2019 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants