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

Remove DB_ERROR_WRONG_NUM_FIELDS and ensure TXT_DB_read always prints a message for an error #17060

Closed

Conversation

deejgregor
Copy link

This makes two changes in related code for loading index.txt:

  1. Removes the DB_ERROR_WRONG_NUM_FIELDS define which was never actually returned from TXT_DB_read (see commit message for details).
  2. Makes sure that all failures in load_index print out an error message. The changes introduced in apps/openssl: make index.txt errors more verbose #15360 already ensure that all callers of load_index will also print out a message, this just adds another level of detail inside of load_index. Note: I'm not familiar with ERR_raise_data, so I did not follow that pattern that was used elsewhere in this function. Please feel free to further tweak or I'm happy to take suggestions to improve this.

An alternative to this PR is the work I first did in this branch: https://github.com/openssl/openssl/compare/master...deejgregor:fix-txt-db-read-failure-reporting?expand=1 . That, however, feels too verbose for the value added and it seems like a refactoring to use ERR_raise_data would be better to get that level of specificity of errors, and I'm not sure it is worth it for this code (and my lack of familiarity with ERR_raise_data would also make this more complex for me to complete). So, I instead propose the simpler solution in this PR.

Checklist

This never worked since it was introduced in
51b04a6 because TXT_DB_read always
returns NULL when there's an error, so the 'ret' struct containing
the DB_ERROR_WRONG_NUM_FIELDS error gets discarded.

All other functions in this file are passed in a TXT_DB * and can
indicate the existance an error in their return value. TXT_DB_read
acts differently because it returns a TXT_DB * or a NULL in the
case of an error.

CLA: trivial
All failures in load_index will now print out an error message.

CLA: trivial
@paulidale paulidale added approval: otc review pending This pull request needs review by an OTC member branch: master Merge to master branch cla: trivial One of the commits is marked as 'CLA: trivial' labels Nov 18, 2021
Copy link
Contributor

@paulidale paulidale left a comment

Choose a reason for hiding this comment

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

I'm okay with CLA: trivial for this -- it's marginal.

@paulidale paulidale added approval: review pending This pull request needs review by a committer triaged: refactor The issue/pr requests/implements refactoring and removed approval: otc review pending This pull request needs review by an OTC member labels Nov 18, 2021
@t8m
Copy link
Member

t8m commented Nov 18, 2021

IMO this is really borderline - especially adding the message part. Would you please submit a regular CLA?

@@ -27,7 +27,6 @@
# define DB_ERROR_INDEX_OUT_OF_RANGE 3
# define DB_ERROR_NO_INDEX 4
# define DB_ERROR_INSERT_INDEX_CLASH 5
# define DB_ERROR_WRONG_NUM_FIELDS 6
Copy link
Member

Choose a reason for hiding this comment

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

This is an API break and so it would not be acceptable earlier than in 4.0.

Why do you remove this particular error?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, it isn't really returned anywhere. But then OK, just keep the define here and perhaps add a comment, that it is never really returned.

Copy link
Author

Choose a reason for hiding this comment

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

I'll fix. Thanks!

@deejgregor deejgregor marked this pull request as draft November 18, 2021 23:56
@openssl-machine
Copy link
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 30 days ago

@paulidale paulidale added hold: cla required The contributor needs to submit a license agreement stalled: awaiting contributor response This pull request is awaiting a response by the contributor cla: trivial One of the commits is marked as 'CLA: trivial' and removed cla: trivial One of the commits is marked as 'CLA: trivial' labels Dec 19, 2021
@openssl-machine
Copy link
Collaborator

This PR is waiting for the creator to make requested changes but it has not been updated for 30 days. If you have made changes or commented to the reviewer please make sure you re-request a review (see icon in the 'reviewers' section).

@openssl-machine
Copy link
Collaborator

This PR is waiting for the creator to make requested changes but it has not been updated for 61 days. If you have made changes or commented to the reviewer please make sure you re-request a review (see icon in the 'reviewers' section).

@openssl-machine
Copy link
Collaborator

This PR has been closed. It was waiting for the creator to make requested changes but it has not been updated for 90 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: review pending This pull request needs review by a committer branch: master Merge to master branch cla: trivial One of the commits is marked as 'CLA: trivial' hold: cla required The contributor needs to submit a license agreement stalled: awaiting contributor response This pull request is awaiting a response by the contributor triaged: refactor The issue/pr requests/implements refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants