develooper Front page | perl.perl5.porters | Postings from November 2003

[perl #24404] g@perl.org Subject: require "string" may load a directory

From:
Stas Bekman
Date:
November 4, 2003 21:24
Subject:
[perl #24404] g@perl.org Subject: require "string" may load a directory
Message ID:
rt-24404-67026.13.62139496519@rt.perl.org
# New Ticket Created by  Stas Bekman 
# Please include the string:  [perl #24404]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24404 >



This is a bug report for perl from stas@rabbit.stason.org,
generated with the help of perlbug 1.34 running under perl v5.8.2.


-----------------------------------------------------------------
[Please enter your report here]

Consider:

   % perl-5.8.2 -le 'my $mod = "threads"; require $mod'
   threads did not return a true value at -e line 1.

require() has read the directory 'threads' as a file. What would happen
if the directory's contents happened to have a true value at the end? will
require be sucessful? Shouldn't it test that the file it's going to read
is actually a file?

This issue was raised the makemaker list, where Tim Bunce had voiced this opinion:

I'd rather that it checked it was not a directory (S_IFDIR, and not
a block special device: S_IFBLK).

People can do funky things with named pipes and sockets and char
devices. We shouldn't be stopping them.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
     category=core
     severity=low
---
Site configuration information for perl v5.8.2:

Configured by stas at Mon Nov  3 02:52:44 PST 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
   Platform:
     osname=linux, osvers=2.4.22-10mdk, archname=i686-linux-thread-multi
     uname='linux rabbit.stason.org 2.4.22-10mdk #1 thu sep 18 12:30:58 cest 
2003 i686 unknown unknown gnulinux '
     config_args='-des -Dprefix=/home/stas/perl/5.8.2-ithread -Dusethreads 
-Doptimize=-g -Duseshrplib -Dusedevel'
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
     use64bitint=undef use64bitall=undef uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
     optimize='-g',
     cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING 
-fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
     ccversion='', gccversion='3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk)', 
gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
     alignbytes=4, prototype=define
   Linker and Libraries:
     ld='cc', ldflags =' -L/usr/local/lib'
     libpth=/usr/local/lib /lib /usr/lib
     libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
     libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so
     gnulibc_version='2.3.2'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic 
-Wl,-rpath,/home/stas/perl/5.8.2-ithread/lib/5.8.2/i686-linux-thread-multi/CORE'
     cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
     RC2

---
@INC for perl v5.8.2:
     /home/stas/perl/5.8.2-ithread/lib/5.8.2/i686-linux-thread-multi
     /home/stas/perl/5.8.2-ithread/lib/5.8.2
     /home/stas/perl/5.8.2-ithread/lib/site_perl/5.8.2/i686-linux-thread-multi
     /home/stas/perl/5.8.2-ithread/lib/site_perl/5.8.2
     /home/stas/perl/5.8.2-ithread/lib/site_perl
     .

---
Environment for perl v5.8.2:
     HOME=/home/stas
     LANG=en_GB
     LANGUAGE=en_GB:en
     LC_ADDRESS=en_CA
     LC_COLLATE=en_GB
     LC_CTYPE=en_GB
     LC_IDENTIFICATION=en_CA
     LC_MEASUREMENT=en_CA
     LC_MESSAGES=en_GB
     LC_MONETARY=en_CA
     LC_NAME=en_CA
     LC_NUMERIC=en_CA
     LC_PAPER=en_CA
     LC_TELEPHONE=en_CA
     LC_TIME=en_GB
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
 
PATH=/usr//bin:/bin:/usr/bin:.:/usr/local/bin:/usr/X11R6/bin:/usr/games:/home/stas/bin:/home/stas/bin:/usr/local/bin:/usr/X11R6/bin:/usr/java/j2re1.4.0/bin/
     PERLDOC_PAGER=less -R
     PERL_BADLANG (unset)
     SHELL=/bin/tcsh






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