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

Document warning 'readline() on unopened filehandle %s' #17936

Merged
merged 1 commit into from Jul 31, 2020

Conversation

jkeenan
Copy link
Contributor

@jkeenan jkeenan commented Jul 4, 2020

Place it in category: (W unopened).

Signed-off-by: James E Keenan jkeenan@cpan.org

For: #17935

Place it in category: (W unopened).

Signed-off-by: James E Keenan <jkeenan@cpan.org>

For: #17935
@jkeenan jkeenan added discovered-thru-p7-research Issue was discovered in the course of research in the core-p7 branch documentation labels Jul 4, 2020
@jkeenan jkeenan requested a review from atoomic July 17, 2020 20:49
@jkeenan jkeenan self-assigned this Jul 17, 2020
@tonycoz
Copy link
Contributor

tonycoz commented Jul 21, 2020

This is one of a set of messages generated by report_evil_fh(), which match:

/(opname_with_parens) on (unopened|closed) (socket|filehandle)/

where opname_with_parens is readline() or -s etc.

Technically the message covered by the patch is covered by the:

=item %s() on unopened %s

(W unopened) An I/O operation was attempted on a filehandle that was
never initialized.  You need to do an open(), a sysopen(), or a socket()
call, or call a constructor from the FileHandle package.

entry, but so are several others.

@jkeenan
Copy link
Contributor Author

jkeenan commented Jul 21, 2020

This is one of a set of messages generated by report_evil_fh(), which match:

/(opname_with_parens) on (unopened|closed) (socket|filehandle)/

where opname_with_parens is readline() or -s etc.

Technically the message covered by the patch is covered by the:

=item %s() on unopened %s

(W unopened) An I/O operation was attempted on a filehandle that was
never initialized.  You need to do an open(), a sysopen(), or a socket()
call, or call a constructor from the FileHandle package.

entry, but so are several others.

Could we list in this item all the I/O operations which might be represented by the %s there? I believe that if the string readline had been present in this item I would have found it by grepping the document and never have had to file #17935 in the first place.

@tonycoz
Copy link
Contributor

tonycoz commented Jul 21, 2020

The entry pointed out isn't the easiest to find (though diagnostics finds it:

$ ./perl -Ilib -Mdiagnostics -we 'readline(FOO); readline(FOO)'
readline() on unopened filehandle at -e line 1 (#1)
    (W unopened) An I/O operation was attempted on a filehandle that was
    never initialized.  You need to do an open(), a sysopen(), or a socket()
    call, or call a constructor from the FileHandle package.

)

I think exploding the messages from report_evil_fh() out to separate messages is reasonable (which is your patch does at least for readline).

So is filling out the entry I pointed out to include the ops would work too.

Either works for me.

@toddr toddr merged commit 7766c83 into blead Jul 31, 2020
@rjbs rjbs deleted the readline-perldiag-20200704 branch May 8, 2021 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discovered-thru-p7-research Issue was discovered in the course of research in the core-p7 branch documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants