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

protect against loading a dir - do $dir no set $@ or $! #609

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mohawk2
Copy link

@mohawk2 mohawk2 commented Dec 30, 2017

Arguably this is a shortcoming in Perl's do. Anyway, I claim that a false $app is an invalid thing to return from load_psgi, so dieing is always appropriate. Comments welcome!

{
eval { Plack::Util::load_psgi("t/Plack-Util/") };
# Perl 5.20+ gives "Did you try to load a directory",
# <=5.18 "No such file or directory"
Copy link
Member

Choose a reason for hiding this comment

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

is this comment accurate?

Copy link
Author

Choose a reason for hiding this comment

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

I was highly surprised as well. See Travis's results on the previous version of this before I force-pushed this over the top: https://travis-ci.org/plack/Plack/builds/323431062

Copy link
Member

Choose a reason for hiding this comment

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

I confirmed perl 5.18 reports "No such file or directory" given a directory as its argument for do. I think it's worth reporting to upstream (p5p) or make sure if this was an intentional change, since the previous behavior was more useful.

Copy link
Author

@mohawk2 mohawk2 Dec 31, 2017

Choose a reason for hiding this comment

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

Go ahead! In the meantime, unless there will be further releases of 5.20 etc, it seems like this is a useful change. Do you require changes?

Copy link
Member

Choose a reason for hiding this comment

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

well since you discovered it you go ahead and report it :)

this will give the same error message for a valid perl code that failed to return from .psgi. You're right that a false value is not a right PSGI application, but the error message seems misleading to me.

Copy link
Author

Choose a reason for hiding this comment

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

I will adjust it now!

Copy link
Author

Choose a reason for hiding this comment

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

Now it will just report returned invalid value., which seems to me Ok when appended to the existing Error while loading $_file:?

@mohawk2
Copy link
Author

mohawk2 commented Jan 19, 2018

@miyagawa Have you had a chance to review this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants