Hi,
I'd like to report a bug in perl, which is that if foo is a directory,
"perl -c foo" always responds with "foo syntax OK." (The most common
way this comes up is if you have a program foo that lives in a directory
called foo, so you intended "perl -c foo/foo," but accidentally did
"perl -c foo" instead.)
Regards,
Ben
-------------------------------
output of perl -V
-------------------------------
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=linux, osvers=2.6.24-15-server, archname=x86_64-linux-gnu-thread-multi
uname='linux crested 2.6.24-15-server #1 smp mon apr 7 17:10:32 utc 2008 x86_64 gnulinux '
config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=x86_64-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.10 -Darchlib=/usr/lib/perl/5.10 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.10.0 -Dsitearch=/usr/local/lib/perl/5.10.0 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so.5.10.0 -Dd_dosuid -des'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -g',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='4.3.1', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64
libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
perllibs=-ldl -lm -lpthread -lc -lcrypt
libc=/lib/libc-2.8.90.so, so=so, useshrplib=true, libperl=libperl.so.5.10.0
gnulibc_version='2.8.90'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API
Built under linux
Compiled at Jul 24 2008 09:03:56
@INC:
/etc/perl
/usr/local/lib/perl/5.10.0
/usr/local/share/perl/5.10.0
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.10
/usr/share/perl/5.10
/usr/local/lib/site_perl
.
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:
open("/tmp", O_RDONLY|O_LARGEFILE) = 3
...
read(3, 0x851973c, 4096) = -1 EISDIR (Is a directory)
close(3) = 0
write(2, "/tmp syntax OK\n", 15) = 15
--
My Dad used to say 'always fight fire with fire', which is probably why
he got thrown out of the fire brigade.
> 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