Took a look at the myeval() implementation and it seems to have some potential issues: not checking return values, ignoring output from perl_call_sv without telling perl via G_DISCARD...
On Mon, Nov 14, 2011 at 5:41 PM, Chris Marshall <[email protected]> wrote: > We'll I misread the code. It appears the check for the compile > is ok but the PDL::Core::myeval may not be returning the fail. > > Anyone have an idea on what the origin of PDL::Core::myeval > was and why it was needed? > > --Chris > > On Mon, Nov 14, 2011 at 5:23 PM, Chris Marshall <[email protected]> > wrote: >> It looks like a bug in perldl. I can reproduce the >> same behavior as well. The problem appears to be >> either the eval on line 655 generating $__coderef >> or some overly aggressive error message filtering >> in the substitutions to remove extra 'in cleanup' stuff >> from the $@. My bet is the first one since not >> checking for $@ would mean that compile errors in >> creating $__coderef would not be caught. >> >> --Chris >> >> On Mon, Nov 14, 2011 at 3:32 PM, Derek Lamb <[email protected]> wrote: >>> In pdl2 it works just fine. Here's an example that has nothing to do with >>> any PDL module, only the PDL shell being used. In the perldl shell, when I >>> try to print to an unopened file handle, I get no error, but when I do the >>> same thing in the pdl2 shell it gives me an appropriate error. I guess one >>> workaround would be to abandon the perldl shell on this machine, but it's >>> worked just fine for so many years, and works just fine on other >>> platforms... I'm so confused. >>> >>> cheers, >>> Derek >>> >>> ###use perldl shell >>> $ perl -Mblib perldl >>> perlDL shell v1.354_001 >>> <snip> >>> Loaded PDL v2.4.9_010 (supports bad values) >>> pdl> print STDOUT "here is a stdout message\n"; >>> here is a stdout message >>> >>> pdl> print STDERR "here is a stderr message\n"; >>> here is a stderr message >>> >>> pdl> print ASDF "here is a asdf message\n"; >>> >>> pdl> exit >>> >>> ### use pdl2 shell >>> $ perl -Mblib blib/script/pdl2 >>> Use of qw(...) as parentheses is deprecated at >>> /Users/derek/Build/PDL/blib/lib/PDL/Perldl2/Script.pm line 28. >>> Use of qw(...) as parentheses is deprecated at >>> /Users/derek/Build/PDL/blib/lib/PDL/Perldl2/Script.pm line 38. >>> Perldl2 Shell v0.005 >>> <snip> >>> Loaded PDL v2.4.9_010 >>> >>> load_rcfile: got $HOME = /Users/derek >>> load_rcfile: loading /Users/derek/.perldlrc >>> pdl> print STDOUT "here is a stdout message\n"; >>> here is a stdout message >>> >>> pdl> print STDERR "here is a stderr message\n"; >>> here is a stderr message >>> >>> pdl> print ASDF "here is a asdf message\n"; >>> print() on unopened filehandle ASDF at (eval 367) line 5, <DATA> line 387. >>> >>> pdl> exit >>> >>> >>> On Nov 12, 2011, at 12:13 AM, chm wrote: >>> >>>> I just tried the example in pdl2 and perldl for >>>> cygwin and strawberry perl on winXP and was unable >>>> to reproduce the problem. Maybe someone else will >>>> have better luck. If you run pdl2, do you get the >>>> same problem? (If you don't have Devel::REPL installed >>>> then pdl2 should fall back to perldl). >>>> >>>> --Chris >>>> >>>> On 11/11/2011 7:40 PM, Derek Lamb wrote: >>>>> I'm resurrecting this old email, because I think a similar problem >>>>> I'm having is related, and am looking for more ways to dig into it. >>>>> >>>>> In the perldl shell, PDL::AutoLoader doesn't complain (as I expect it >>>>> to) if it can't find a file to autoload. In particular if I do the >>>>> following: ---------- pdl> $PDL::verbose=1 pdl> $PDL::debug=1 pdl> >>>>> asdf() AutoLoader: Expanding directories from .:.:+~/pdl:+./pdl... >>>>> AutoLoader: returning .,.,/Users/derek/pdl,<snip a whole bunch of >>>>> directories>, Loading asdf.pdl ...I am here and $s is PDL AutoLoader: >>>>> Undefined subroutine asdf() cannot be autoloaded. ----------- Where I >>>>> have inserted a statement >>>>> >>>>> print "I am here and \$s is $s\n" >>>>> >>>>> to line 208 of Basic/AutoLoader.pm, right before the line >>>>> >>>>> die $s."\tNo file `$func.pdl' was found in your \@PDLLIB path.\n"; >>>>> >>>>> It seems like the call to perl's die is getting executed, because a >>>>> print statement inserted after the die call does not get executed. >>>>> >>>>> If I run the same thing as a one-liner I get the appropriate error: >>>>> -------- $ perl -MPDL::AutoLoader -e 'asdf();' PDL AutoLoader: >>>>> Undefined subroutine asdf() cannot be autoloaded. No file `asdf.pdl' >>>>> was found in your @PDLLIB path. -------- >>>>> >>>>> ***And if I run perldl in the debugger, I also get the desired >>>>> error*** >>>>> >>>>> ------- $ perl -d perldl __DB<1> n ##then press enter until it gets >>>>> to the addhistory line around perldl:252 DB<2> use PDL::AutoLoader >>>>> >>>>> DB<3> asdf() PDL AutoLoader: Undefined subroutine asdf() cannot be >>>>> autoloaded. No file `asdf.pdl' was found in your @PDLLIB path. >>>>> ------- >>>>> >>>>> So it's not like AutoLoader is inherently broken, but rather >>>>> something about running perldl _NOT_ in the debugger is causing calls >>>>> to perl's die() to not print their messages. I'm running a much >>>>> simpler Perl installation now, since I accidentally wiped my whole >>>>> perl tree last weekend. So now the only PDL installed is 2.4.9_010. >>>>> And experiments with different ReadLine modules (Perl, Gnu) that >>>>> Chris suggested did not seem to help any. I don't see any >>>>> $SIG{__DIE__} definitions in perldl, but there are some elsewhere in >>>>> the PDL source tree, but nothing looked likely to me. >>>>> >>>>> Any other ideas? >>>>> >>>>> cheers, Derek >>>>> >>>>> >>>>> On Aug 5, 2011, at 8:03 AM, Chris Marshall wrote: >>>>> >>>>>> Hi Derek- >>>>>> >>>>>> I cannot reproduce the problem with PDL-2.4.9 for either the >>>>>> one-liner, pdl2, or perldl. All report the mismatch error. Two >>>>>> thoughts come to mind: >>>>>> >>>>>> (1) Try using the perl readline for your shell (assuming you are >>>>>> using GNU readline by default. Maybe the error is there but being >>>>>> "lost" somehow, e.g.: >>>>>> >>>>>> PERL_RL=Perl perldl >>>>>> >>>>>> (2) It is possible that you have some contamination between the >>>>>> 2.4.7 PDL install and any others on your system. Sometimes it is >>>>>> difficult to isolate everything. The only sure way would probably >>>>>> be a complete, separate perl install and all modules for the 2.4.7 >>>>>> stuff. >>>>>> >>>>>> Are the two systems you need to be bug-for-bug compatible on the >>>>>> same OS, hardware, perl, ...? If not, it might be difficult to be >>>>>> fully "compatible". >>>>>> >>>>>> Cheers, Chris >>>>>> >>>>>> On Thu, Aug 4, 2011 at 4:47 PM, Derek Lamb<[email protected]> >>>>>> wrote: >>>>>>> If I run this one-liner on the command-line, I get the expected >>>>>>> warning: >>>>>>> >>>>>>> $ perl -MPDL -e 'print ones(2,4)+zeroes(5,7);' PDL: >>>>>>> PDL::Ops::plus(a,b,c): Parameter 'b' PDL: Mismatched implicit >>>>>>> thread dimension 0: should be 2, is 5 >>>>>>> >>>>>>> Caught at file -e, line 1, pkg main >>>>>>> >>>>>>> >>>>>>> If I run it in the pdl2 shell, I get the warning. But if I run >>>>>>> the same thing in the perldl shell, I get no warning at all--it >>>>>>> looks like a successful command unless I try to assign that to a >>>>>>> variable and find out later that the variable doesn't exist. >>>>>>> This happens for PDL 2.4.7 as well as the current git >>>>>>> (2.4.9_004). I do get the warning in the perldl shell on a Linux >>>>>>> machine running 2.4.9_002. So it makes me think there is a funny >>>>>>> interaction between the components of my current setup. perldl >>>>>>> -V output is pasted below. FWIW I'm still running PDL 2.4.7 >>>>>>> because for now I need to be bug-for-bug compatible with another >>>>>>> machine in a production environment. Has anybody else seen >>>>>>> something like this, or have any ideas? >>>>>>> >>>>>>> Derek >>>>>>> >>>>>>> ---------- >>>>>>> >>>>>>> $ perldl -V perlDL shell v1.354 PDL comes with ABSOLUTELY NO >>>>>>> WARRANTY. For details, see the file 'COPYING' in the PDL >>>>>>> distribution. This is free software and you are welcome to >>>>>>> redistribute it under certain conditions, see the same file for >>>>>>> details. >>>>>>> >>>>>>> Summary of my PDL configuration >>>>>>> >>>>>>> VERSION: PDL v2.4.7 (supports bad values) >>>>>>> >>>>>>> $%PDL::Config = { 'BADVAL_PER_PDL' => '0', 'WITH_PROJ' => '1', >>>>>>> 'FFTW_TYPE' => 'double', 'FFTW_LIBS' => [ '/opt/local/lib' ], >>>>>>> 'WITH_FFTW' => '1', 'GSL_LIBS' => undef, 'GL_BUILD' => '0', >>>>>>> 'WITH_IO_BROWSER' => '0', 'PROJ_INC' => [ '/opt/local/include' >>>>>>> ], 'WHERE_PLPLOT_INCLUDE' => >>>>>>> '/Users/derek/local/include/plplot', 'WITH_KARMA' => '0', >>>>>>> 'WHERE_KARMA' => undef, 'HTML_DOCS' => '1', >>>>>>> 'SKIP_KNOWN_PROBLEMS' => '0', 'WHERE_PLPLOT_LIBS' => >>>>>>> '/Users/derek/local/lib', 'WITH_3D' => '1', 'WITH_POSIX_THREADS' >>>>>>> => '0', 'FFTW_INC' => [ '/opt/local/include' ], 'POGL_VERSION' >>>>>>> => '0.63', 'HIDE_TRYLINK' => '1', 'HDF_INC' => [ >>>>>>> '/opt/local/include' ], 'WITH_HDF' => '1', 'POGL_WINDOW_TYPE' => >>>>>>> 'glut', 'WITH_GD' => '1', 'WITH_BADVAL' => '1', 'FITS_LEGACY' >>>>>>> => '1', 'WITH_SLATEC' => '1', 'BADVAL_USENAN' => '0', >>>>>>> 'WITH_DEVEL_REPL' => '1', 'TEMPDIR' => >>>>>>> '/var/folders/cp/cpF7SuTpEJqtly5xlloAak+++TI/-Tmp-', 'PROJ_LIBS' >>>>>>> => [ '/opt/local/lib' ], 'USE_POGL' => '1', 'GD_LIBS' => [ >>>>>>> '/opt/local/lib' ], 'GSL_INC' => undef, 'GD_INC' => [ >>>>>>> '/opt/local/include' ], 'OPTIMIZE' => '-g', 'WITH_GSL' => '1', >>>>>>> 'HDF_LIBS' => [ '/opt/local/lib' ], 'MALLOCDBG' => {}, >>>>>>> 'WITH_PLPLOT' => '0', 'WITH_MINUIT' => '1', 'MINUIT_LIB' => >>>>>>> undef }; Summary of my perl5 (revision 5 version 14 subversion 1) >>>>>>> configuration: >>>>>>> >>>>>>> Platform: osname=darwin, osvers=10.7.0, >>>>>>> archname=darwin-multi-2level uname='darwin turul 10.7.0 darwin >>>>>>> kernel version 10.7.0: sat jan 29 15:17:16 pst 2011; >>>>>>> root:xnu-1504.9.37~1release_i386 i386 ' config_args='-D >>>>>>> inc_version_list=5.14.0/darwin-multi-2level 5.14.0 -des >>>>>>> -Dprefix=/opt/local -Dscriptdir=/opt/local/bin >>>>>>> -Dcppflags=-I/opt/local/include -Dccflags=-pipe -O2 -arch x86_64 >>>>>>> -Dldflags=-L/opt/local/lib -arch x86_64 -Dvendorprefix=/opt/local >>>>>>> -Dusemultiplicity=y -D cc=/usr/bin/gcc-4.2 -D ld=/usr/bin/gcc-4.2 >>>>>>> -D man1ext=1pm -D man3ext=3pm -D >>>>>>> man1dir=/opt/local/share/man/man1p -D >>>>>>> man3dir=/opt/local/share/man/man3p -D >>>>>>> siteman1dir=/opt/local/share/man/man1 -D >>>>>>> siteman3dir=/opt/local/share/man/man3 -D >>>>>>> vendorman1dir=/opt/local/share/man/man1 -D >>>>>>> vendorman3dir=/opt/local/share/man/man3 -D pager=/usr/bin/less >>>>>>> -sR' hint=recommended, useposix=true, d_sigaction=define >>>>>>> useithreads=undef, usemultiplicity=define useperlio=define, >>>>>>> d_sfio=undef, uselargefiles=define, usesocks=undef >>>>>>> use64bitint=define, use64bitall=define, uselongdouble=undef >>>>>>> usemymalloc=n, bincompat5005=undef Compiler: >>>>>>> cc='/usr/bin/gcc-4.2', ccflags ='-pipe -O2 -arch x86_64 >>>>>>> -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp >>>>>>> -fno-strict-aliasing -fstack-protector -I/opt/local/include', >>>>>>> optimize='-O3', cppflags='-I/opt/local/include -no-cpp-precomp >>>>>>> -pipe -O2 -arch x86_64 -fno-common -DPERL_DARWIN >>>>>>> -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing >>>>>>> -fstack-protector -I/opt/local/include' ccversion='', >>>>>>> gccversion='4.2.1 (Apple Inc. build 5666) (dot 3)', >>>>>>> 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='env >>>>>>> MACOSX_DEPLOYMENT_TARGET=10.6 /usr/bin/gcc-4.2', ldflags >>>>>>> ='-L/opt/local/lib -arch x86_64 -fstack-protector' >>>>>>> libpth=/opt/local/lib /usr/lib libs=-lgdbm -ldbm -ldl -lm -lutil >>>>>>> -lc perllibs=-ldl -lm -lutil -lc libc=, so=dylib, >>>>>>> useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic >>>>>>> Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, >>>>>>> ccdlflags=' ' cccdlflags=' ', lddlflags='-L/opt/local/lib -arch >>>>>>> x86_64 -bundle -undefined dynamic_lookup -fstack-protector' >>>>>>> ----------- >>>>>>> >>>>>>> >>>>>>> _______________________________________________ Perldl mailing >>>>>>> list [email protected] >>>>>>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >>>> >>> >>> >> > _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
