develooper Front page | perl.perl5.porters | Postings from December 2008

Re: [perl #61362] bug report: "perl -c foo" always reports "foo syntax OK" if foo is a directory

Thread Previous
From:
Slaven Rezic
Date:
December 16, 2008 23:49
Subject:
Re: [perl #61362] bug report: "perl -c foo" always reports "foo syntax OK" if foo is a directory
Message ID:
87tz93s0mi.fsf@biokovo-amd64.herceg.de
Dave Mitchell <davem@iabyn.com> writes:

> On Sun, Dec 14, 2008 at 09:28:39PM -0500, Eric Brine wrote:
>> FYI, it could be one of ActivePerl's patches, but Windows actually gets it
>> right. Tested with both 5.8.8 and 5.10.0. (perl -v below)
>> 
>> >perl -c foo
>> Can't open perl script "foo": Permission denied
>
> With bleed on linux, I get silent "success":
>
> $ ./perl -c /tmp
> /tmp syntax OK
>
> An strace shows that it is ignoring a read error while trying to
> read the directory:

On FreeBSD, it is actually possible to _execute_ a directory if it has
an appropriate filename. First create directory and file:

mkdir "/tmp/dirhack";
open my $fh, ">", qq{/tmp/dirhack/\n#!perl\nprint "Hello, world!\\n";\n__END__\n}
    or die $!;
__END__

and then run

     perl -x /tmp/dirhack

Regards,
    Slaven

-- 
Slaven Rezic - slaven <at> rezic <dot> de
  BBBike - route planner for cyclists in Berlin
  WWW version:                           http://www.bbbike.de
  Perl/Tk version for Unix and Windows:  http://bbbike.sourceforge.net

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About