Front page | perl.perl5.porters |
Postings from August 2000
[ID 20000816.010] perl_eval_{sv,pv} does not trap syntax errors
Thread Next
From:
gisle
Date:
August 16, 2000 12:18
Subject:
[ID 20000816.010] perl_eval_{sv,pv} does not trap syntax errors
Message ID:
20000816191756.5724.qmail@eik.g.aas.no
This is a bug report for perl from gisle@aas.no,
generated with the help of perlbug 1.28 running under perl v5.6.0.
-----------------------------------------------------------------
[Please enter your report here]
I have this application (actually Python) that embeds perl and calls
perl_eval_pv() to pass code to it. One problem with this is that
perl_eval_pv(code, FALSE) does not set ERRSV (aka $@) on syntax
errors.
This is a little example program showing this behaviour:
---------------------------------------------------------
#include <EXTERN.h>
#include <perl.h>
int main(int argc, char**argv, char**env)
{
int i;
char *embedding[] = {"", "-e", "0"};
PerlInterpreter *my_perl = perl_alloc();
perl_construct(my_perl);
perl_parse(my_perl, NULL, 3, embedding, NULL);
perl_run(my_perl);
perl_eval_pv("sub { ", TRUE);
/*** the program ought to abort here ***/
if (SvTRUE(ERRSV))
PerlIO_printf(Perl_debug_log, "XXX %s", SvPV_nolen(ERRSV));
perl_eval_pv("1/0", TRUE);
if (SvTRUE(ERRSV))
PerlIO_printf(Perl_debug_log, "YYY %s", SvPV_nolen(ERRSV));
/*** it aborts here ***/
printf("done\n");
}
/*
Compile with: cc check-eval-syntax-error.c `perl -MExtUtils::Embed -e ccopts -e ldopts`
*/
---------------------------------------------------------
This program prints:
$ ./a.out
Illegal division by zero at (eval 2) line 2.
instead of something with "syntax error in (eval 1)".
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl v5.6.0:
Configured by gisle at Mon May 22 17:07:41 CEST 2000.
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
Platform:
osname=linux, osvers=2.2.5, archname=i686-linux
uname='linux eik 2.2.5 #1 mon sep 13 14:53:01 cest 1999 i686 unknown '
config_args='-Dprefix=/local/perl/5.6.0_priv -Doptimize=-g -ders'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define
use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
Compiler:
cc='cc', optimize='-g', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
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, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt
libc=, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl v5.6.0:
/local/perl/5.6.0_priv/lib/5.6.0/i686-linux
/local/perl/5.6.0_priv/lib/5.6.0
/local/perl/5.6.0_priv/lib/site_perl/5.6.0/i686-linux
/local/perl/5.6.0_priv/lib/site_perl/5.6.0
/local/perl/5.6.0_priv/lib/site_perl
.
---
Environment for perl v5.6.0:
HOME=/home/gisle
LANG=POSIX
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=...
PERL_BADLANG (unset)
SHELL=/bin/bash
Thread Next
-
[ID 20000816.010] perl_eval_{sv,pv} does not trap syntax errors
by gisle