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
LTA error message when executing directories as perl6 code #4396
Comments
From @AlexDaniel$ mkdir somefolder Although it mentions that something is a directory, still the error could |
From @geekosaurOn Sat, Jul 11, 2015 at 7:28 PM, Alex Jakimenko <
Note that behavior here can differ substantially: some OSes won't let you -- |
The RT System itself - Status changed from 'new' to 'open' |
From @nwc10On Sat, Jul 11, 2015 at 07:41:40PM -0400, Brandon Allbery wrote:
Perl 5 has an explicit test for "is it a directory", to get a consistent error commit 1dfef69b3a0643e5cf8879e1476b0163c3e8a9b2 croak on an attempt to run a directory as a script Inline Patchdiff --git a/perl.c b/perl.c
index c7e1d54..d4f13df 100644
--- a/perl.c
+++ b/perl.c
@@ -3649,6 +3649,7 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, bool *suidscript)
int fdscript = -1;
PerlIO *rsfp = NULL;
dVAR;
+ Stat_t tmpstatbuf;
PERL_ARGS_ASSERT_OPEN_SCRIPT;
@@ -3758,6 +3759,13 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, bool *suidscript)
/* ensure close-on-exec */
fcntl(PerlIO_fileno(rsfp), F_SETFD, 1);
#endif
+
+ if (PerlLIO_fstat(PerlIO_fileno(rsfp), &tmpstatbuf) >= 0
+ && S_ISDIR(tmpstatbuf.st_mode))
+ Perl_croak(aTHX_ "Can't open perl script \"%s\": %s\n",
+ CopFILE(PL_curcop),
+ strerror(EISDIR));
+
return rsfp;
}
Nicholas Clark |
From @jnthnOn Sun Jul 12 02:19:35 2015, nicholas wrote:
Implemented, and added a test in S19-command-line/arguments.t. |
@jnthn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#125600 (status was 'resolved')
Searchable as RT125600$
The text was updated successfully, but these errors were encountered: