Skip to content

perldoc does not generate doc properly if run as root and file is not world readable #17701

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

Closed
daniel4andre opened this issue Apr 9, 2020 · 3 comments

Comments

@daniel4andre
Copy link

If I have a file (in fact a script that uses Pod::Usage to generate man page) that can be read only by root (mode is 0700), perldoc can't generate documentation:
perldoc bar.pod Error while formatting with Pod::Perldoc::ToTerm: Can't open bar.pod: Permission denied at /usr/share/perl/5.26/Pod/Perldoc/ToTerm.pm line 113.
I get a similar result if directory is readable only by root.

If run by root, privileges are dropped and the file or directory cannot be accessed.

@jkeenan
Copy link
Contributor

jkeenan commented Apr 9, 2020

If I have a file (in fact a script that uses Pod::Usage to generate man page) that can be read only by root (mode is 0700), perldoc can't generate documentation:
perldoc bar.pod Error while formatting with Pod::Perldoc::ToTerm: Can't open bar.pod: Permission denied at /usr/share/perl/5.26/Pod/Perldoc/ToTerm.pm line 113.
I get a similar result if directory is readable only by root.

If run by root, privileges are dropped and the file or directory cannot be accessed.

For several reasons, I don't think this is a valid bug report for the Perl 5 core distribution.

  1. While both Pod::Usage and Pod::Perldoc::ToTerm are shipped with the Perl 5 core distribution, the distributions which contain them are maintained upstream on CPAN. Hence, the proper place to file a bug report would be at their listed bug trackers:

https://metacpan.org/release/Pod-Perldoc -> https://rt.cpan.org/Dist/Display.html?Name=Pod-Perldoc

https://metacpan.org/pod/Pod::Usage -> https://metacpan.org/pod/Pod::Usage

  1. Using Pod::Usage to write man pages is probably stretching it well beyond its intended use. On the face of it, Pod::Man would seem to be a more obvious choice for that task.

  2. Have you read the parts of perldoc perldoc which pertain to SECURITY? The perldoc utility is part of the Pod-Perldoc CPAN distribution, and its own POD documentation provides a good overall guide to usage of that distribution. I don't claim any particular expertise here, but what you're doing as root sounds suspect. If you really must run as root, then you should thoroughly explore both the code and documentation in these CPAN distributions.

Thank you very much.
Jim Keenan

@jkeenan jkeenan added the Closable? We might be able to close this ticket, but we need to check with the reporter label Apr 9, 2020
@jkeenan jkeenan self-assigned this Apr 9, 2020
@daniel4andre
Copy link
Author

daniel4andre commented Apr 10, 2020

Thank you for your comment. As I can understand the first two points, why do you say that root can't run 'protected_script --man' to see the documentation?

As I understand, Pod::Man is used to generate nroff formatted man pages. I use Pod::Usage in my script to generate usage information and man page as suggested in Pod::Usage documentation along with Getop::Long:
myscript --help # for brief usage message myscript --help # for full man page piped to default pager

@jkeenan jkeenan removed their assignment Apr 29, 2020
@jkeenan
Copy link
Contributor

jkeenan commented Jun 9, 2025

Thank you for your comment. As I can understand the first two points, why do you say that root can't run 'protected_script --man' to see the documentation?

As I understand, Pod::Man is used to generate nroff formatted man pages. I use Pod::Usage in my script to generate usage information and man page as suggested in Pod::Usage documentation along with Getop::Long: myscript --help # for brief usage message myscript --help # for full man page piped to default pager

The upstream maintainers of the Pod-Perldoc and Pod-Usage distribution are better equipped to respond to these questions than I am. I'm closing this ticket and urging you to open tickets in those upstream bug trackers (as I recommended in point #1 back in 2020).

@jkeenan jkeenan closed this as completed Jun 9, 2025
@jkeenan jkeenan added sendToCPAN and removed Closable? We might be able to close this ticket, but we need to check with the reporter labels Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants