Skip Menu |
 

This queue is for tickets about the MailTools CPAN distribution.

Report information
The Basics
Id: 11171
Status: resolved
Priority: 0/
Queue: MailTools

People
Owner: Nobody in particular
Requestors: nothingmuch [...] woobling.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.66
Fixed in: (no value)



Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.415 (Entity 5.415)
Subject: Mail::Field tries to require Mail::Field::$p with $p being every basename in my file system
X-RT-Original-Encoding: iso-8859-1
Content-Length: 3014
Download (untitled) / with headers
text/plain 2.9k
on line 115 of Mail::Field $INC{$f} is matched for .*Mail\W+Field. the begining can be empty, at which point $dir is assigned "" . $dir_sep, or "/" on my box. I don't know how $INC is populated with such values, and I don't really care. The point is that subsequently it tries to require everything in the file system. It should also be noted that the values of $INC can even be undefined at times. I added this: next if !$INC{$f} or $INC{$f} eq $f; as line 111, as the first statement in the foreach loop, and it helps, but it's not very pretty. This is on MacOS X 10.3, with perl 5.9.1 uname -a: Darwin syeeda.woobling.org 7.7.0 Darwin Kernel Version 7.7.0: Sun Nov 7 16:06:51 PST 2004; root:xnu/xnu-517.9.5.obj~1/RELEASE_PPC Power Macintosh unknown PowerBook3,2 Darwin perl -V Summary of my perl5 (revision 5 version 9 subversion 1) configuration: Platform: osname=darwin, osvers=7.4.0, archname=darwin-thread-multi-2level uname='darwin syeeda.int.hyperroll.com 7.4.0 darwin kernel version 7.4.0: wed may 12 16:58:24 pdt 2004; root:xnuxnu-517.7.7.obj~7release_ppc power macintosh powerpc ' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=define 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 ='-pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include', optimize='-Os', cppflags='-no-cpp-precomp -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1640)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lc perllibs=-ldl -lm -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Built under darwin Compiled at Aug 20 2004 09:00:12 %ENV: PERL5_CPANPLUS_CONFIG="/Users/nothingmuch/.cpanplus/config" @INC: /usr/local/lib/perl5/5.9.1/darwin-thread-multi-2level /usr/local/lib/perl5/5.9.1 /usr/local/lib/perl5/site_perl/5.9.1/darwin-thread-multi-2level /usr/local/lib/perl5/site_perl/5.9.1 /usr/local/lib/perl5/site_perl .
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.415 (Entity 5.415)
X-RT-Original-Encoding: iso-8859-1
Content-Length: 1583
Download (untitled) / with headers
text/plain 1.5k
[guest - Fri Jan 21 08:44:16 2005]: Show quoted text
> on line 115 of Mail::Field $INC{$f} is matched for .*Mail\W+Field. the > begining can be empty, at which point $dir is assigned "" . > $dir_sep, or "/" on my box.
Why do you think that? The match is /(.*Mail\W+Field)/ which means that there is at least a Mail?Field in the result. I must say that it is very poorly coded (happily I didn't write it). I would say if($INC{$f} =~ /(.*Mail\W+Field)/i) { $dir = $1 . $dir_sep } Show quoted text
> I don't know how $INC is populated with such values, and I don't > really care. The point is that subsequently it tries to require > everything in the file system. It should also be noted that the > values of $INC can even be undefined at times.
It's %INC which is populated, not $INC. %INC translated module names into filenames on disk. When you say use My::Module; then the directories named in @INC (filled with "use lib") are searched through, one by one. When the file for the module is found, it is added as $INC{'My::Module'} = 'Path/to/My/Module.pm'; Show quoted text
> I added this: > next if !$INC{$f} or $INC{$f} eq $f;
This is silly, because it has nothing to do the way %INC works. The ditry part of code you are looking into is used to figure-out which Mail::Field::* modules are defined. It look's-up where Mail::Field is installed, and then scans it's sub-directories. The Mail::Field module is certainly known in %INC, because this code is defined in package Mail::Field itself!! You may have hit a bug in 5.9, which is a development release of Perl. Don't use it, use 5.8.6
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.415 (Entity 5.415)
X-RT-Original-Encoding: iso-8859-1
Content-Length: 739
Download (untitled) / with headers
text/plain 739b
Show quoted text
> my bad... I was tired when I wrote that. Regardless, somehow the > traversal code manages to start traversing "/" and every file on the > system is required as a module.
You tell me that all directories in your file-system are being searched, but I really have no idea how that can happen when I read the code. Show quoted text
> Ignoring the problem won't make it go away. Module::Pluggable, or a > more portable/safe way might. I suggest at least using File::Find > instead of that scary traversal code.
I do not ignore the problem: I simply do not see the problem. The code is correct IMHO. I simply do not see the problem and do not understand your solution, although that may work. Until both are satisfied, i will not change the code. Sorry


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.