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

Stop load_psgi from searching .psgi files from @INC #343

Merged
merged 4 commits into from Oct 16, 2012

Conversation

miyagawa
Copy link
Member

If you have foo.psgi in any of your @INC paths, running plackup foo.psgi used to try to load the one in there first rather than the current directory, which is listed as the last entry of include paths with usual perl.

This would confuse users potentially. With this change load_psgi function in Plack::Util does a little more DWIMmery to make it into ./foo.psgi unless the given path begins with / (slash).

Arguably this might break some users, who uses this feature for their CPAN modules to install PSGI scripts into @INC expecting it to be picked up by plackup foo.psgi. That will stop working, although we never recommended it, and if they have a module (not a script) like MyApp::PSGI into include paths that will keep working.

miyagawa and others added 4 commits October 16, 2012 08:32
…e args.

This might break users who installs `foo.psgi` into @inc directories
and expect `plackup foo.psgi` to load them from there - it's been a
mix of documented (loading class names like MyApp::PSGI) and
undocumented feature anyways.
@miyagawa
Copy link
Member Author

@plack/core care to take a look?

@doy
Copy link
Member

doy commented Oct 16, 2012

+1 from me, this does seem like unexpected behavior. The other option
here would be to explicitly put . at the front of @INC before
loading the file, which might preserve existing behavior a bit better,
if that's important. Not sure if that would still end up being too
clever/confusing though.

@bobtfish
Copy link
Member

+1 here, and -1 for pushing . onto @inc - this just adds more magic..

miyagawa added a commit that referenced this pull request Oct 16, 2012
Stop load_psgi from searching .psgi files from @inc
@miyagawa miyagawa merged commit 63882c6 into master Oct 16, 2012
@KnowZero
Copy link

This change breaks Catalyst on Windows :(

C:\Sites\Test\script>perl64 test_server.pl
Error while loading ./C:\Sites\Test\test.psgi: No such file or directory at (eval 1307) line 4, line 1000.

Using ActiveState Perl 5.16 64bit on Windows 2008R2 64bit and IIS 7.5 and Plack 1.0007 and Catalyst 5.90016.

Is it possible to change line 128 of lib/Plack/Util.pm to:

$file =~ m!^(?:/|[a-zA-Z]\:)! ? $file : "./$file";

@miyagawa
Copy link
Member Author

What's the content of test_server.pl?

@KnowZero
Copy link

The default Catalyst generates:

BEGIN {

$ENV{CATALYST_SCRIPT_GEN} = 40;

}

use Catalyst::ScriptRunner;

Catalyst::ScriptRunner->run('Test', 'Server');

1;

@KnowZero
Copy link

The problem is unlike Linux, Windows has drive letters and "./C:" is an invalid path.

miyagawa added a commit that referenced this pull request Oct 23, 2012
miyagawa added a commit that referenced this pull request Oct 23, 2012
Changelog diff is:

diff --git a/Changes b/Changes
index 76d3cd1..6e958c6 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 Go to http://github.com/plack/Plack/issues for the roadmap and known issues.

+1.0008  Mon Oct 22 18:52:29 PDT 2012
+    [BUG FIXES]
+        - Allow drive letters for absolute paths for plackup and load_psgi #343
+
 1.0007  Sat Oct 20 23:20:20 PDT 2012
     [IMPROVEMENTS]
         - Fix test failures with HTTP::Message 6.06. #345
miyagawa added a commit that referenced this pull request Oct 23, 2012
Changelog diff is:

diff --git a/Changes b/Changes
index 6e958c6..1823d91 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 Go to http://github.com/plack/Plack/issues for the roadmap and known issues.

+1.0009  Tue Oct 23 00:57:16 PDT 2012
+    [BUG FIXES]
+        - Correct fix to address drive letters for Win32
+
 1.0008  Mon Oct 22 18:52:29 PDT 2012
     [BUG FIXES]
         - Allow drive letters for absolute paths for plackup and load_psgi #343
wchristian pushed a commit to wchristian/Plack that referenced this pull request Nov 22, 2013
Changelog diff is:

diff --git a/Changes b/Changes
index f7ced00..13330ff 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,17 @@
 Go to http://github.com/plack/Plack/issues for the roadmap and known issues.

+1.0006  Thu Oct 18 16:06:15 PDT 2012
+    [INCOMPATIBLE CHANGES]
+        - plackup foo.psgi will not search the file in @inc anymore before the current directory
+          See plack#343 for details (miyagawa)
+
+    [NEW FEATURES]
+        - plackup --path /foo will mount the application under /path (mattn)
+
+    [BUG FIXES]
+        - AccessLog: Fix the timezon offset for certain timezones
+        - ErrorDocument: support streaming interface
+
 1.0005  Tue Oct  9 13:33:47 PDT 2012
     [NEW FEATURES]
         - Support psgix.cleanup handlers in Apache2 (avar)
jperkin pushed a commit to TritonDataCenter/pkgsrc-legacy that referenced this pull request Dec 9, 2013
Upstream changes:
1.0015 Thu Jan 10 15:19:17 PST 2013
    [BUG FIXES]
        - Fixed Lint complaining about Latin-1 range characters stored internally with
          utf8 flag on (Mark Fowler)
        - HTTP::Message::PSGI::res_from_psgi now always returns empty string
          for an empty response body, so streamed responses are consistent with
          non-streamed (ether)

1.0014 Mon Dec  3 10:27:43 PST 2012
    [BUG FIXES]
        - Fixed Hash order in tests for perl 5.17 (doy)
        - Fixed StackTrace tests to run with Devel::StackTrace

    [IMPROVEMENTS]
        - Plack::Middleware::AccessLog can now log the worker pid and server
          port (ether)

1.0013  Wed Nov 14 19:46:49 PST 2012
    [BUG FIXES]
        - Make sure psgi.input is seeked even when the input is buffered (Getty, leedo)
        - Delete invalid (empty) CONTENT_LENGTH and CONTENT_TYPE in FCGI (Getty, leedo)

1.0012  Wed Nov 14 12:00:17 PST 2012
    [IMPROVEMENTS]
        - Make conditional middleware work with initialization without an app (doy)
        - Added force option to BufferedStreaming

1.0011  Sun Nov 11 11:05:30 PST 2012
    [BUG FIXES]
        - Fix bad Content-Length that could be caused with mod_perl (avar)
        - Allow an empty PATH_INFO in Lint per PSGI spec

1.0010  Fri Nov  2 13:30:50 PDT 2012
    [IMPROVEMENTS]
        - Added vim .swp files to the default ignore list in Restarter
        - Check if PATH_INFO begins with / in Lint

1.0009  Tue Oct 23 00:57:16 PDT 2012
    [BUG FIXES]
        - Correct fix to address drive letters for Win32

1.0008  Mon Oct 22 18:52:29 PDT 2012
    [BUG FIXES]
        - Allow drive letters for absolute paths for plackup and load_psgi #343

1.0007  Sat Oct 20 23:20:20 PDT 2012
    [IMPROVEMENTS]
        - Fix test failures with HTTP::Message 6.06. #345
        - relaxed plackup -R ignore files and directoris. #260

1.0006  Thu Oct 18 16:06:15 PDT 2012
    [INCOMPATIBLE CHANGES]
        - plackup foo.psgi will not search the file in @inc anymore before the current directory
          See plack/Plack#343 for details (miyagawa)

    [NEW FEATURES]
        - plackup --path /foo will mount the application under /path (mattn)

    [BUG FIXES]
        - AccessLog: Fix the timezon offset for certain timezones
        - ErrorDocument: support streaming interface

1.0005  Tue Oct  9 13:33:47 PDT 2012
    [NEW FEATURES]
        - Support psgix.cleanup handlers in Apache2 (avar)
        - Added REMOTE_PORT environment variable to HTTP::Server::PSGI (dex4er)

    [IMPROVEMENTS]
        - Documentation fix for multiple cookie values (miyagawa)
        - Delete MOD_PERL environment variable for better compatibilities (avar)
        - Split out Plack::TempBuffer as a standalone Stream::Buffered module (doy)
        - Bump Test::TCP dep

1.0004  Thu Sep 20 08:36:11 JST 2012
    [NEW FEATURES]
        - Added psgix.harakiri support in HTTP::Server::PSGI

    [IMPROVEMENTS]
        - Preload TempBuffer modules (avar)
        - Documentation fixes (autarch)
jperkin pushed a commit to TritonDataCenter/pkgsrc-legacy that referenced this pull request Mar 14, 2014
Upstream changes:
1.0015 Thu Jan 10 15:19:17 PST 2013
    [BUG FIXES]
        - Fixed Lint complaining about Latin-1 range characters stored internally with
          utf8 flag on (Mark Fowler)
        - HTTP::Message::PSGI::res_from_psgi now always returns empty string
          for an empty response body, so streamed responses are consistent with
          non-streamed (ether)

1.0014 Mon Dec  3 10:27:43 PST 2012
    [BUG FIXES]
        - Fixed Hash order in tests for perl 5.17 (doy)
        - Fixed StackTrace tests to run with Devel::StackTrace

    [IMPROVEMENTS]
        - Plack::Middleware::AccessLog can now log the worker pid and server
          port (ether)

1.0013  Wed Nov 14 19:46:49 PST 2012
    [BUG FIXES]
        - Make sure psgi.input is seeked even when the input is buffered (Getty, leedo)
        - Delete invalid (empty) CONTENT_LENGTH and CONTENT_TYPE in FCGI (Getty, leedo)

1.0012  Wed Nov 14 12:00:17 PST 2012
    [IMPROVEMENTS]
        - Make conditional middleware work with initialization without an app (doy)
        - Added force option to BufferedStreaming

1.0011  Sun Nov 11 11:05:30 PST 2012
    [BUG FIXES]
        - Fix bad Content-Length that could be caused with mod_perl (avar)
        - Allow an empty PATH_INFO in Lint per PSGI spec

1.0010  Fri Nov  2 13:30:50 PDT 2012
    [IMPROVEMENTS]
        - Added vim .swp files to the default ignore list in Restarter
        - Check if PATH_INFO begins with / in Lint

1.0009  Tue Oct 23 00:57:16 PDT 2012
    [BUG FIXES]
        - Correct fix to address drive letters for Win32

1.0008  Mon Oct 22 18:52:29 PDT 2012
    [BUG FIXES]
        - Allow drive letters for absolute paths for plackup and load_psgi #343

1.0007  Sat Oct 20 23:20:20 PDT 2012
    [IMPROVEMENTS]
        - Fix test failures with HTTP::Message 6.06. #345
        - relaxed plackup -R ignore files and directoris. #260

1.0006  Thu Oct 18 16:06:15 PDT 2012
    [INCOMPATIBLE CHANGES]
        - plackup foo.psgi will not search the file in @inc anymore before the current directory
          See plack/Plack#343 for details (miyagawa)

    [NEW FEATURES]
        - plackup --path /foo will mount the application under /path (mattn)

    [BUG FIXES]
        - AccessLog: Fix the timezon offset for certain timezones
        - ErrorDocument: support streaming interface

1.0005  Tue Oct  9 13:33:47 PDT 2012
    [NEW FEATURES]
        - Support psgix.cleanup handlers in Apache2 (avar)
        - Added REMOTE_PORT environment variable to HTTP::Server::PSGI (dex4er)

    [IMPROVEMENTS]
        - Documentation fix for multiple cookie values (miyagawa)
        - Delete MOD_PERL environment variable for better compatibilities (avar)
        - Split out Plack::TempBuffer as a standalone Stream::Buffered module (doy)
        - Bump Test::TCP dep

1.0004  Thu Sep 20 08:36:11 JST 2012
    [NEW FEATURES]
        - Added psgix.harakiri support in HTTP::Server::PSGI

    [IMPROVEMENTS]
        - Preload TempBuffer modules (avar)
        - Documentation fixes (autarch)
jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Oct 11, 2014
Upstream changes:
1.0015 Thu Jan 10 15:19:17 PST 2013
    [BUG FIXES]
        - Fixed Lint complaining about Latin-1 range characters stored internally with
          utf8 flag on (Mark Fowler)
        - HTTP::Message::PSGI::res_from_psgi now always returns empty string
          for an empty response body, so streamed responses are consistent with
          non-streamed (ether)

1.0014 Mon Dec  3 10:27:43 PST 2012
    [BUG FIXES]
        - Fixed Hash order in tests for perl 5.17 (doy)
        - Fixed StackTrace tests to run with Devel::StackTrace

    [IMPROVEMENTS]
        - Plack::Middleware::AccessLog can now log the worker pid and server
          port (ether)

1.0013  Wed Nov 14 19:46:49 PST 2012
    [BUG FIXES]
        - Make sure psgi.input is seeked even when the input is buffered (Getty, leedo)
        - Delete invalid (empty) CONTENT_LENGTH and CONTENT_TYPE in FCGI (Getty, leedo)

1.0012  Wed Nov 14 12:00:17 PST 2012
    [IMPROVEMENTS]
        - Make conditional middleware work with initialization without an app (doy)
        - Added force option to BufferedStreaming

1.0011  Sun Nov 11 11:05:30 PST 2012
    [BUG FIXES]
        - Fix bad Content-Length that could be caused with mod_perl (avar)
        - Allow an empty PATH_INFO in Lint per PSGI spec

1.0010  Fri Nov  2 13:30:50 PDT 2012
    [IMPROVEMENTS]
        - Added vim .swp files to the default ignore list in Restarter
        - Check if PATH_INFO begins with / in Lint

1.0009  Tue Oct 23 00:57:16 PDT 2012
    [BUG FIXES]
        - Correct fix to address drive letters for Win32

1.0008  Mon Oct 22 18:52:29 PDT 2012
    [BUG FIXES]
        - Allow drive letters for absolute paths for plackup and load_psgi #343

1.0007  Sat Oct 20 23:20:20 PDT 2012
    [IMPROVEMENTS]
        - Fix test failures with HTTP::Message 6.06. #345
        - relaxed plackup -R ignore files and directoris. #260

1.0006  Thu Oct 18 16:06:15 PDT 2012
    [INCOMPATIBLE CHANGES]
        - plackup foo.psgi will not search the file in @inc anymore before the current directory
          See plack/Plack#343 for details (miyagawa)

    [NEW FEATURES]
        - plackup --path /foo will mount the application under /path (mattn)

    [BUG FIXES]
        - AccessLog: Fix the timezon offset for certain timezones
        - ErrorDocument: support streaming interface

1.0005  Tue Oct  9 13:33:47 PDT 2012
    [NEW FEATURES]
        - Support psgix.cleanup handlers in Apache2 (avar)
        - Added REMOTE_PORT environment variable to HTTP::Server::PSGI (dex4er)

    [IMPROVEMENTS]
        - Documentation fix for multiple cookie values (miyagawa)
        - Delete MOD_PERL environment variable for better compatibilities (avar)
        - Split out Plack::TempBuffer as a standalone Stream::Buffered module (doy)
        - Bump Test::TCP dep

1.0004  Thu Sep 20 08:36:11 JST 2012
    [NEW FEATURES]
        - Added psgix.harakiri support in HTTP::Server::PSGI

    [IMPROVEMENTS]
        - Preload TempBuffer modules (avar)
        - Documentation fixes (autarch)
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.

None yet

4 participants