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

Wordsmithing and naming consistency #1798

Closed
wants to merge 2 commits into from
Closed

Wordsmithing and naming consistency #1798

wants to merge 2 commits into from

Conversation

kaduk
Copy link
Contributor

@kaduk kaduk commented Oct 28, 2016

An old wordsmithing patch I had lying around on this branch name, plus some cleanup for the recent BIO rework. Try to make BIO_{read,write}{,ex} and BIO{puts,gets} parameter names match across implementation, declaration, and documentation.

  • documentation is added or updated
  • CCLA is signed

@@ -806,7 +806,7 @@
possible to create your own ".conf" and ".tmpl" files and store
them locally, outside the OpenSSL source tree. This environment
variable can be set to the directory where these files are held
and will have Configure to consider them in addition to the
and will have Configure to consider them in preference to the
Copy link
Member

Choose a reason for hiding this comment

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

I disagree, but perhaps it's my english. I understand "in preference" that Configure would look at the indicated local config dir instead of the standard ones. That is not the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't feel particularly strongly, but "in addition to", to me, indicates that it is appended at the end, so that if something is in the systemwide configuration it takes effect first. Maybe we want something about "override".

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, how about "will have Configure consider them before looking in the standard ones."?

@@ -111,39 +111,39 @@ or

is called before the free operation.

=item B<BIO_read_ex(b, out, outl, read)>
=item B<BIO_read_ex(b, data, dlen, read)>
Copy link
Member

Choose a reason for hiding this comment

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

I would replace all occurences of read as parameter with readbytes, just to avoid shadowing read(2) and confusing people...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like I missed that part of the change, as the implementation uses readbytes.

int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *read);
int BIO_gets(BIO *bp, char *buf, int size);
int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes);
int BIO_gets(BIO *bp, char *out, int outl);
Copy link
Member

Choose a reason for hiding this comment

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

No, please avoid using out and in in the BIO input and output routines. It's confusing, as to some people (such as myself), out signifies something that goes out (i.e. not something you read) and in signifies something that comes in (i.e. not something you write).

So please revert the BIO_gets() change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My primary goal was consistency, as the implementation uses out/outl. I'm happy to make it consistent the other way, though.

Copy link
Member

Choose a reason for hiding this comment

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

Please do it the other way around, yes.

int BIO_write(BIO *b, const void *data, int dlen);
int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written);
int BIO_puts(BIO *bp, const char *buf);
int BIO_puts(BIO *bp, const char *in);
Copy link
Member

Choose a reason for hiding this comment

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

Please revert the BIO_puts() change. See my explanation at the BIO_gets() change.

Make it clear that the OPENSSL_LOCAL_CONFIG_DIR settings take precedence over
the in-tree configs.
@kaduk
Copy link
Contributor Author

kaduk commented Oct 28, 2016

(Force-)pushed updated versions of both commits.

int BIO_write(BIO *b, const void *buf, int len);
int BIO_puts(BIO *b, const char *buf);
int BIO_read(BIO *b, void *data, int dlen);
int BIO_gets(BIO *b, char *out, int outl);
Copy link
Member

Choose a reason for hiding this comment

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

Oops, didn't notice this one earlier.

int BIO_read(BIO *b, void *data, int dlen);
int BIO_gets(BIO *b, char *out, int outl);
int BIO_write(BIO *b, const void *data, int dlen);
int BIO_puts(BIO *b, const char *in);
Copy link
Member

Choose a reason for hiding this comment

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

... nor this one


is called before the operation and

callback_ex(b, BIO_CB_GETS | BIO_CB_RETURN, out, outl, 0, 0L, retvalue, read)
callback_ex(b, BIO_CB_GETS | BIO_CB_RETURN, data, dlen, 0, 0L, retvalue, NULL)
Copy link
Member

Choose a reason for hiding this comment

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

NULL? Are you sure about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. Too many calls to keep track of, I guess.
(Updates in progress for all mentioned issues.)


after.

=item B<BIO_puts(b, in)>
=item B<BIO_puts(b, data)>
Copy link
Member

Choose a reason for hiding this comment

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

Nit-pick: buf


after.

=item B<BIO_gets(b, out, outl)>
=item B<BIO_gets(b, data, dlen)>
Copy link
Member

Choose a reason for hiding this comment

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

Nit-pick: buf

int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *read);
int BIO_gets(BIO *bp, char *buf, int size);
int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes);
int BIO_gets(BIO *bp, char *data, int dlen);
Copy link
Member

Choose a reason for hiding this comment

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

Again, please reverse

int BIO_write(BIO *b, const void *data, int dlen);
int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written);
int BIO_puts(BIO *bp, const char *buf);
int BIO_puts(BIO *bp, const char *data);
Copy link
Member

Choose a reason for hiding this comment

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

... and here

@levitte
Copy link
Member

levitte commented Oct 28, 2016

Re buf vs data... it seems like we've used buf for the line reading/writing API (gets/puts) while using data for the block read/write API... I realise I argue for keeping that difference, but not strongly so. You decide.

@kaduk
Copy link
Contributor Author

kaduk commented Oct 28, 2016

Re buf vs data... it seems like we've used buf for the line reading/writing API (gets/puts) while using data for the block read/write API... I realise I argue for keeping that difference, but not strongly so. You decide.

buf for strings seems reasonable (I'll go with 'size' for the length argument for now) ... and looking at the man page, I still missed several conversions in the previous iteration. So many places to change...

After the recent reworking, not everything matched up, and some comments didn't
catch up to the outl-->dlen and inl-->dlen renames that happened during the
development of the recent patches.

Try to make parameter names consistent across header, implementation,
and manual pages.

Also remove some trailing whitespace that was inadvertently introduced.
@kaduk
Copy link
Contributor Author

kaduk commented Oct 28, 2016

Updated again.
(I still have not figured out when github sends email about new commits, and so err on the side of more notification.)

Copy link
Member

@levitte levitte left a comment

Choose a reason for hiding this comment

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

Yes, now I'm happy!

@levitte
Copy link
Member

levitte commented Oct 28, 2016

What's your target? master only or master + 1.1.0 or what? Set the PR lables accordingly.

@levitte levitte self-assigned this Oct 28, 2016
@kaduk
Copy link
Contributor Author

kaduk commented Oct 28, 2016

It looks like the BIO size_t-ification didn't hit 1.1.0, so this should be master-only. (It doesn't look like I have permissions to add/edit labels.)

@levitte levitte added the branch: master Merge to master branch label Oct 28, 2016
@levitte
Copy link
Member

levitte commented Oct 28, 2016

Right. Label added

@mattcaswell mattcaswell added the approval: done This pull request has the required number of approvals label Oct 28, 2016
@levitte
Copy link
Member

levitte commented Oct 28, 2016

Merged!

@levitte levitte closed this Oct 28, 2016
levitte pushed a commit that referenced this pull request Oct 28, 2016
Make it clear that the OPENSSL_LOCAL_CONFIG_DIR settings take
precedence over the in-tree configs.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #1798)
levitte pushed a commit that referenced this pull request Oct 28, 2016
After the recent reworking, not everything matched up, and some
comments didn't catch up to the outl-->dlen and inl-->dlen renames
that happened during the development of the recent patches.

Try to make parameter names consistent across header, implementation,
and manual pages.

Also remove some trailing whitespace that was inadvertently introduced.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #1798)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: done This pull request has the required number of approvals branch: master Merge to master branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants