develooper Front page | perl.perl5.porters | Postings from January 2001

[ID 20010116.021] $SIG{__DIE__} action-at-distance bug in base.pm

From:
njs
Date:
January 16, 2001 18:03
Subject:
[ID 20010116.021] $SIG{__DIE__} action-at-distance bug in base.pm
Message ID:
E14IhxC-0004MV-00@WyrmWeyr.frop.org
This is a bug report for perl from njs@uclink4.berkeley.edu,
generated with the help of perlbug 1.28 running under perl v5.6.0.


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

The base.pm module is susceptible to the old $SIG{__DIE__}
action-at-distance bug; at line 58 it does:
        unless (exists ${"$base\::"}{VERSION}) {
            eval "require $base";
            # Only ignore "Can't locate" errors from our eval require.
            # Other fatal errors (syntax etc) must be reported.
            die if $@ && $@ !~ /^Can't locate .*? at \(eval /;
The problem comes if a $SIG{__DIE__} handler is installed -- the non-error
that occurs when $base is not a package in its own file gets handed to
the handler, and if the error message is modified, or anything else goes
wrong, the whole program can be taken down.  This can happen when someone
is using CGI::Carp, for example, or any other sort of die handler.

Oddly, the same code appears in the base.pm from perl 5.005, but only since
I installed 5.6 yesterday has this bug been causing all my CGI scripts to
fail.

Recommended solution:
Modify base.pm so that the line
            eval "require $base";
becomes
            eval "local $SIG{__DIE__}; require $base";

Thank you for you time.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=medium
---
Site configuration information for perl v5.6.0:

Configured by bod at Fri Dec 29 18:36:20 EST 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.18, archname=i386-linux
    uname='linux duende 2.2.18 #1 thu dec 28 14:51:40 est 2000 i686 unknown '
    config_args='-de -D prefix=/usr -D archname=i386-linux -D startperl=#!/usr/bin/perl-5.6 -D privlib=/usr/lib/perl5/5.6 -D archlib=/usr/lib/perl5/5.6/i386-linux -D sitelib=/usr/local/lib/site_perl -D man1dir=/usr/share/man/man1 -D man1ext=1p -D man3dir=/usr/share/man/man3 -D man3ext=3pm -D ccflags=-D_REENTRANT -DDEBIAN -DAPPLLIB_EXP="/usr/lib/perl5" -D optimize=-O2  -D cccdlflags=-fPIC -D d_dosuid=define -U usesfio -D d_csh=undef -D d_statblks=define -D i_db -D i_ndbm -U installusrbinperl -D pager=/usr/bin/pager -D perladmin=perl@packages.debian.org -D useshrplib -D libperl=libperl.so.5.6.0 -D vendorprefix=/usr -D vendorlib=/usr/lib/perl5/5.005 -D vendorarch=/usr/lib/perl5/5.005/i386-linux'
    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='-O2 ', gccversion=2.95.2 20000220 (Debian GNU/Linux)
    cppflags='-D_REENTRANT -DDEBIAN -DAPPLLIB_EXP="/usr/lib/perl5" -fno-strict-aliasing -I/usr/local/include'
    ccflags ='-D_REENTRANT -DDEBIAN -DAPPLLIB_EXP="/usr/lib/perl5" -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 -ldl -lm -lc -lcrypt
    libc=/lib/libc-2.2.so, so=so, useshrplib=true, libperl=libperl.so.5.6.0
  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:
    /usr/lib/perl5/i386-linux
    /usr/lib/perl5
    /usr/lib/perl5/5.6/i386-linux
    /usr/lib/perl5/5.6
    /usr/local/lib/site_perl/i386-linux
    /usr/local/lib/site_perl
    /usr/lib/perl5/5.005/i386-linux
    /usr/lib/perl5/5.005
    .

---
Environment for perl v5.6.0:
    HOME=/home/njs
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/home/njs/src/cvs/berlin/Berlin/build-debug/lib:/home/njs/src/cvs/berlin/Berlin/build-debug/modules:
    LOGDIR (unset)
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/X11R6/bin:/usr/local/bin:/usr/games:/usr/lib/teTeX/bin:.:/home/njs:/home/njs/bin:/usr/X11R6/bin:/usr/local/bin:/usr/games:/usr/lib/teTeX/bin:.:/home/njs:/home/njs/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash




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