Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Carp::Heavy? #1780

Closed
p5pRT opened this issue Apr 5, 2000 · 3 comments
Closed

Bug in Carp::Heavy? #1780

p5pRT opened this issue Apr 5, 2000 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 5, 2000

Migrated from rt.perl.org#3034 (status was 'resolved')

Searchable as RT3034$

@p5pRT
Copy link
Author

p5pRT commented Apr 5, 2000

From Richard.Foley@m.dasa.de

I'm not sure if this is a bug or what.

BTW, I tried sending a bug report twice and it didn't go through so
instead I'll send a patch.

Anyway, under 5.6.0 it seems that the results of caller have changed ever
so slightly. Previously, when eval'ing a block {} (caller(0))[6]
(evaltext) was not returned at all (it returned a 5 elements list). Under
perl5.6.0 it now returns 0. This caused a problem in
Carp​::Heavy​::longmess which made it print stuff like a require had
happened.

Here's a quick test script that illustrates the issue (compare under
5.00503 to 5.6.0)​:

use Carp;

eval {
  print join ' ', map {defined $_ ? $_ : 'undef'} caller(0);
  print "\n";
  confess 'foo';
};
print $@​;

Here's a patch​:

Inline Patch
--- /usr/local/lib/perl5/5.6.0/Carp/H   Tue Apr  4 23:10:47 2000
+++ /usr/local/lib/perl5/5.6.0/Carp/Heavy.pm    Tue Apr  4 23:17:56 2000
@@ -58,7 +58,7 @@
        } else {
            # Build a string, $sub, which names the sub-routine called.
            # This may also be "require ...", "eval '...' or "eval {...}"
-           if (defined $eval) {
+           if ($eval) {
                if ($require) {
                    $sub = "require $eval";
                } else {

The only problem (and it's not much of one) is that if you were to do:

$SIG{__DIE__} = sub { confess(@​_) };

and then do​:

eval '0';

and that eval caused a fatal error (dunno how though) it might cause Carp
to report incorrectly. OTOH, I think that's a heck of a rare special
case. OTOH (yes, I have 3) maybe the Perl core needs to be changed to
revert to the previous behavior of returning a 5 element list.

and here's my perl -V​:

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration​:
  Platform​:
  osname=linux, osvers=2.2.5-15, archname=i586-linux
  uname='linux urth.org 2.2.5-15 #15 mon jul 5 01​:48​:48 cdt 1999 i586
unknown '
  config_args=''
  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.1 19990816 (release)
  cppflags='-fno-strict-aliasing -I/usr/local/include'
  ccflags ='-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 -ldb -ldl -lm -lc -lposix -lcrypt
  libc=/lib/libc-2.1.1.so, 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'

Characteristics of this binary (from libperl)​:
  Compile-time options​: USE_LARGE_FILES
  Built under linux
  Compiled at Mar 23 2000 12​:04​:27
  @​INC​:
  /usr/local/lib/perl5/5.6.0/i586-linux
  /usr/local/lib/perl5/5.6.0
  /usr/local/lib/perl5/site_perl/5.6.0/i586-linux
  /usr/local/lib/perl5/site_perl/5.6.0
  /usr/local/lib/perl5/site_perl
  .

/*==================
www.urth.org
We await the New Sun
==================*/

@p5pRT
Copy link
Author

p5pRT commented May 1, 2003

From @iabyn

This appears to have been fixed in bleedperl.

@p5pRT
Copy link
Author

p5pRT commented May 1, 2003

@iabyn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant