Skip to content

Add missing 'RETURN VALUES' sections in doc#4976

Closed
InfoHunter wants to merge 3 commits intoopenssl:masterfrom
InfoHunter:doc-return-value
Closed

Add missing 'RETURN VALUES' sections in doc#4976
InfoHunter wants to merge 3 commits intoopenssl:masterfrom
InfoHunter:doc-return-value

Conversation

@InfoHunter
Copy link
Copy Markdown
Member

All missing ones are added.

Checklist
  • documentation is added or updated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing stop.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This sounds like different negative values would indicate different error codes, but apparently it's just negative value to signal an error condition...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On side note one can wonder if it's appropriate to elaborate on length units. I mean that it's buffer length, not character count...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One can wonder if it would be appropriate to reword the description. I mean it doesn't actually return a mask, but rather a union [determined by masking specific flags]...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm.... I'm struggling with "a null-terminated string" here. I mean "a" kind of implies "some", while it's quite specific. In DES_fcrypt case it's either buffer supplied by caller or NULL, and in DES_crypt - static buffer or NULL.

[On side note one can wonder if it would be appropriate to not modify buffer if error is returned. I mean DES_fcrypt modifies buffer in case error is returned, and maybe it shouldn't. Once again, this is side note.]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Or could we say 'null terminated buffer' or something like that?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just in case of misunderstanding, I'm struggling specifically with "a", i.e. with it being indefinite article. And underlying question rather is if one should be more specific than referring to unnamed buffer, with or without article. After all, description says nothing about return value, only input arguments, so it might be appropriate to say explicitly how it is. So that reader doesn't have to consult source code...

Copy link
Copy Markdown
Member Author

@InfoHunter InfoHunter Dec 28, 2017

Choose a reason for hiding this comment

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

How about this:

DES_fcrypt() and DES_crypt() return NULL if an error occurred. On success, DES_fcrypt() returns a null-terminated string in user provided buffer and DES_crypt() returns a null-terminated string in a static buffer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well, to me it appears more of a function description than description of return value. I mean part of placing null-terminated string to a buffer. Consider 'man strcpy' for example... So I'd say it should rather read "On success DES_fcrypt() returns pointer to the caller-provided buffer, and DES_crypt() - to a static buffer."

Or related side note one can wonder if DESCRIPTION part needs some adjustments. Most notably mention that returned string is null-terminated. [On related note one can also wonder if "this version takes only a small amount of space" "bragging" clause is actually relevant today.]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is fixed and the 'null-terminated' description is added to section DESCRIPTION.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd rather say "requested [immutable?] version string". I mean it has lesser to do with format, but different information...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like it's "(NONE)", not "(NULL)".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"NID values" stings my eye a little, but that might be just me. I mean ping native English speakers if it should be "NID value"...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NID value - it is a singular return.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd write explicitly "extra data pointer" or "application-supplied extra data"... No?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So far functions were listed without arguments, i.e. as UI_process()...

@dot-asm
Copy link
Copy Markdown
Contributor

dot-asm commented Dec 27, 2017

On common note that there are more things that "sting" my eye. So common ping to native English speakers...

@InfoHunter
Copy link
Copy Markdown
Member Author

Addressed almost all comments and left some comments for native English speakers either...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In such case "flag combination presenting the cause"... Though "representing" might be better...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed

@InfoHunter
Copy link
Copy Markdown
Member Author

InfoHunter commented Dec 28, 2017 via email

Copy link
Copy Markdown
Member

@mattcaswell mattcaswell left a comment

Choose a reason for hiding this comment

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

This is an awesome piece of work!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"returns the number of bytes"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we say something about who is responsible for freeing this data?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is described in the DESCRIPTION section, then still need to re-describe here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok - no need if we say it elsewhere.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"according to whether B<a> is greater than..."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"return the number"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should "BIO method" be written as "BIO_METHOD"?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"return the number of"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Preferred is to avoid contractions: it's => it is (and below)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typo: success

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

or equal to

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typo: occurred

@richsalz
Copy link
Copy Markdown
Contributor

richsalz commented Jan 2, 2018

First off, @InfoHunter, congratulations and thanks for doing this!
Second, could you think about adding this diff?

diff --git a/util/find-doc-nits b/util/find-doc-nits
index 7087d366d2..8d580de045 100755
--- a/util/find-doc-nits
+++ b/util/find-doc-nits
@@ -24,7 +24,6 @@ our($opt_h);
 our($opt_l);
 our($opt_n);
 our($opt_p);
-our($opt_s);
 our($opt_u);
 our($opt_c);
 
@@ -35,7 +34,6 @@ Find small errors (nits) in documentation.  Options:
     -d Detailed list of undocumented (implies -u)
     -l Print bogus links
     -n Print nits in POD pages
-    -s Also print missing sections in POD pages (implies -n)
     -p Warn if non-public name documented (implies -n)
     -u List undocumented functions
     -h Print this help message
@@ -217,7 +215,6 @@ sub check()
 
     foreach ((@{$mandatory_sections{'*'}}, @{$mandatory_sections{$section}})) {
         # Skip "return values" if not -s
-        next if $_ eq 'RETURN VALUES' and not $opt_s;
         print "$id: missing $_ head1 section\n"
             if $contents !~ /^=head1\s+${_}\s*$/m;
     }
@@ -474,13 +471,13 @@ sub checkflags() {
     return $ok;
 }
 
-getopts('cdlnsphu');
+getopts('cdlnphu');
 
 &help() if $opt_h;
-$opt_n = 1 if $opt_s or $opt_p;
+$opt_n = 1 if $opt_p;
 $opt_u = 1 if $opt_d;
 
-die "Need one of -[cdlnspu] flags.\n"
+die "Need one of -[cdlnpu] flags.\n"
     unless $opt_c or $opt_l or $opt_n or $opt_u;
 
 if ( $opt_c ) {

@InfoHunter
Copy link
Copy Markdown
Member Author

Second, could you think about adding this diff?

Yes, glad to do so.

@InfoHunter
Copy link
Copy Markdown
Member Author

All unnecessary 'void' return values are removed. But some ones are left there if all functions in a POD file are all 'void' functions - it's necessary to put words in the section otherwise the section will be empty which is not valid for doc-nits checking.

@mattcaswell mattcaswell added the approval: review pending This pull request needs review by a committer label Jan 3, 2018
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like I was concentrating on wrong "a", huh? I mean initially I was tipped off by "a string", but it's still "a pointer", but to "the buffer". Sorry about possible confusion...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't quite get the point, could you explain a bit more? Seems it's fine saying 'a point to the buffer'....

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Point is that my English sucks. I mean originally I made fuzz about "a" being indefinite article as if it has no bearing here. But it apparently does, "a pointer to the buffer"... Oh well... It was inessential comment...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ahh...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I find this a bit ambiguous. NULL customarily refers to NULL pointer, while we are obviously talking about character here. In other words "terminated by null character" would presumably be better. And I wouldn't be surprised if it should read "terminated by a null character"...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ascii(7) clearly shows the value 0 as NUL '\0' (null character)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, but NULL, i.e. with double L, still has quite too strong pointer "clang"... In other words "NUL character" would also do, "NULL" alone ... not so much....

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, NULL means pointer and NUL means \0 byte. It would be nice to fix this, or a new PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in this PR

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I realize that "BIO method function" is taken from description that was there earlier, but I find the term confusing. I mean it doesn't actually return a function, but rather a dispatch table. Thoughts?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about just remove "function":

memroy BIO method, a structure of function pointers

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That structure contains other data than function pointers...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It might be better by just saying 'return a valid memory B<BIO_METHOD> structure'...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/vaild/valid

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/occured/occurred

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/poisitve/positive

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed

@dot-asm
Copy link
Copy Markdown
Contributor

dot-asm commented Jan 5, 2018

On more essential note could you clarify what needs to be squashed. It looks like everything except perhaps find-doc-nits? Maybe find-doc-nits should even be standalone? Or shall we just squash everything?

@InfoHunter
Copy link
Copy Markdown
Member Author

Yes, I think all commits should be squashed into one commit except the 'find-doc-nits' commit - which is 2015e92 exactly...

@dot-asm dot-asm added the approval: done This pull request has the required number of approvals label Jan 7, 2018
@dot-asm dot-asm removed the approval: review pending This pull request needs review by a committer label Jan 7, 2018
@mattcaswell
Copy link
Copy Markdown
Member

Grrr....I tried to merge this but there are conflicts with master and it now needs a rebase.

@InfoHunter
Copy link
Copy Markdown
Member Author

@mattcaswell rebase is done and I've squashed all necessary commits.

@InfoHunter
Copy link
Copy Markdown
Member Author

Errr, I just noticed seems all changed files' copyright date should be updated to end with 2018, would you guys like to do this in this PR or in a separate one?

@mattcaswell
Copy link
Copy Markdown
Member

Lets do it in this one - if you don't mind doing the updates?

Paul Yang added 3 commits January 16, 2018 01:04
All missing sections are added.
To avoid check failure, make dummy RETURN VALUES sections in the docs
which have no real functions decribed inside...
Because the related PR/commits are merged in 2018...
@InfoHunter
Copy link
Copy Markdown
Member Author

Don't mind and a new commit is added to update the dates - which seems no need to be squashed...

@mattcaswell
Copy link
Copy Markdown
Member

As the new commit is trivial I am assuming @dot-asm's approval still applies and will merge shortly.

levitte pushed a commit that referenced this pull request Jan 16, 2018
All missing sections are added.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #4976)
levitte pushed a commit that referenced this pull request Jan 16, 2018
To avoid check failure, make dummy RETURN VALUES sections in the docs
which have no real functions decribed inside...

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #4976)
levitte pushed a commit that referenced this pull request Jan 16, 2018
Because the related PR/commits are merged in 2018...

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #4976)
@mattcaswell
Copy link
Copy Markdown
Member

Pushed. Thanks.

@richsalz
Copy link
Copy Markdown
Contributor

@InfoHunter , this was a tour de force PR. Thank you!

@InfoHunter
Copy link
Copy Markdown
Member Author

Thanks!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants