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
perl ignores errors when asked to invoke or syntax check a directory #9597
Comments
From perlbugcrowell08@lightandmatter.comHi, I'd like to report a bug in perl, which is that if foo is a directory, Regards, Ben output of perl -V Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Characteristics of this binary (from libperl): |
From @ikegamiOn Sun, Dec 14, 2008 at 2:30 PM, via RT Ben Crowell <
FYI, it could be one of ActivePerl's patches, but Windows actually gets it
This is perl, v5.8.8 built for MSWin32-x86-multi-thread Copyright 1987-2007, Larry Wall Binary build 824 [287188] provided by ActiveState http://www.ActiveState.com This is perl, v5.10.0 built for MSWin32-x86-multi-thread Copyright 1987-2007, Larry Wall Binary build 1001 [283495] provided by ActiveState |
The RT System itself - Status changed from 'new' to 'open' |
From @iabynOn Sun, Dec 14, 2008 at 09:28:39PM -0500, Eric Brine wrote:
With bleed on linux, I get silent "success": $ ./perl -c /tmp An strace shows that it is ignoring a read error while trying to open("/tmp", O_RDONLY|O_LARGEFILE) = 3 -- |
From @eserteDave Mitchell <davem@iabyn.com> writes:
On FreeBSD, it is actually possible to _execute_ a directory if it has mkdir "/tmp/dirhack"; and then run perl -x /tmp/dirhack Regards, -- |
From @jmdhThis isn't specific to '-c' so I have updated the subject accordingly. <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=689412> |
From @rjbsI have written b1469bd to catch this. I haven't written any tests, but can. I have tested it by |
From @jkeenanOn Sat Jan 05 17:53:13 2013, rjbs wrote:
First attempt at a test, attached. Thank you very much. |
From @jkeenan0001-Add-a-test-to-detect-error-when-attempting-to-syntax.patchFrom 975cb0aa2e4cb19f7fe47ba3f9f3caaa2399973a Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Sat, 5 Jan 2013 22:25:29 -0500
Subject: [PATCH] Add a test to detect error when attempting to syntax-check a directory.
Not yet working; todo_skip it.
For: RT #61362
---
t/run/switches.t | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/t/run/switches.t b/t/run/switches.t
index 5c3b5ee..bb46e6a 100644
--- a/t/run/switches.t
+++ b/t/run/switches.t
@@ -11,7 +11,7 @@ BEGIN {
BEGIN { require "./test.pl"; }
-plan(tests => 114);
+plan(tests => 115);
use Config;
@@ -107,6 +107,18 @@ SWTEST
);
}
+TODO: {
+ todo_skip("RT #61362: perl ignores errors when asked to invoke or syntax check a directory");
+ my $tempdir = tempfile;
+ mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
+ like(
+ runperl( switches => [ '-c' ], args => [ $tempdir ], stderr => 1),
+ qr/Can't open perl script.*$tempdir.*is a directory/s,
+ "RT \#61362: Cannot syntax-check a directory"
+ );
+ rmdir $tempdir or die "Can't rmdir '$tempdir': $!";
+}
+
# Tests for -l
$r = runperl(
--
1.6.3.2
|
From @jkeenanOn Sat Jan 05 19:29:55 2013, jkeenan wrote:
Second attempt at a patch. I don't think the test needed to be todo-ed. |
From @jkeenan0001-Add-a-test-to-detect-error-when-attempting-to-syntax.patchFrom d0f59158e7938543e82e306c56f927866a506ed8 Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Sat, 5 Jan 2013 22:25:29 -0500
Subject: [PATCH] Add a test to detect error when attempting to syntax-check a directory.
For: RT #61362
---
t/run/switches.t | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/t/run/switches.t b/t/run/switches.t
index 5c3b5ee..d946106 100644
--- a/t/run/switches.t
+++ b/t/run/switches.t
@@ -11,7 +11,7 @@ BEGIN {
BEGIN { require "./test.pl"; }
-plan(tests => 114);
+plan(tests => 115);
use Config;
@@ -107,6 +107,17 @@ SWTEST
);
}
+{
+ my $tempdir = tempfile;
+ mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
+ like(
+ runperl( switches => [ '-c' ], args => [ $tempdir ], stderr => 1),
+ qr/Can't open perl script.*$tempdir.*is a directory/s,
+ "RT \#61362: Cannot syntax-check a directory"
+ );
+ rmdir $tempdir or die "Can't rmdir '$tempdir': $!";
+}
+
# Tests for -l
$r = runperl(
--
1.6.3.2
|
From @jkeenanOn Sat Jan 05 17:53:13 2013, rjbs wrote:
$ git diff blead...origin/rjbs/cant-run-dir |cat Inline Patchdiff --git a/perl.c b/perl.c
index c7e1d54..892ca42 100644
--- a/perl.c
+++ b/perl.c
@@ -3649,6 +3649,7 @@ S_open_script(pTHX_ const char *scriptname, bool
PERL_ARGS_ASSERT_OPEN_SCRIPT; @@ -3758,6 +3759,13 @@ S_open_script(pTHX_ const char *scriptname, bool Something about the output is amiss: ##### $ ./perl -c frbulous/ $ ./perl frbulous Wouldn't this be better? ##### Thank you very much. |
From @rjbs* James E Keenan via RT <perlbug-followup@perl.org> [2013-01-06T08:56:34]
The semicolon means we'd need a new perldiag entry, so no on that front. The -- |
From @ilmariRicardo Signes <perl.p5p@rjbs.manxome.org> writes:
Wouldn'it be best to use the standard strerror(EISDIR), for consistency? $ cat / -- |
From [Unknown Contact. See original ticket]Fixed in cdd0648 and previous 3 commits. |
@rjbs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#61362 (status was 'resolved')
Searchable as RT61362$
The text was updated successfully, but these errors were encountered: