develooper Front page | perl.perl5.porters | Postings from March 2000

[ID 20000322.013] segfault/error when printing re-blessed obj w/"" overloaded

Thread Previous | Thread Next
From:
etienne
Date:
March 22, 2000 09:50
Subject:
[ID 20000322.013] segfault/error when printing re-blessed obj w/"" overloaded
Message ID:
m12XpIj-0015vhC@anonimo.isr.ist.utl.pt

This is a bug report for perl from etienne@isr.ist.utl.pt,
generated with the help of perlbug 1.26 running under perl 5.00503.


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

  perl seg faults when I give it the following script. It looks like a
bug, doesn't it?

  Etienne

======================================================================
#!/usr/bin/perl -w

##
## Make a package with an overloaded 'stringify' operator, and see if
## I still can see the original reference type (HASH, ARRAY ...)
## 

$! = 1 ;

package Foo ;
use overload '""' => sub {"ARRAY=moo-ha!ha!ha!"} ;

package main ;

$a = {} ;
## Here can tell if it's a hash, array or whatever
print "a=$a, ",ref($a),"\n\n" ;

$b = bless $a,"Foo" ;

## Here can't anymore (btw, $a has been blessed too)
print "b=$b, ",ref($b),"\n" ;
print "a=$a, ",ref($a),"\n\n" ;

## Now, I can again
$c = bless $b, "main" ;
print "c=$c, ",ref($c),"\n" ;
print "b=$b, ",ref($b),"\n" ;
print "a=$a, ",ref($a),"\n\n" ;
======================================================================

  On this machine, the output is :
======================================================================
etienne@anonimo: perl stringify.pl
a=HASH(0x80cc304), HASH

b=ARRAY=moo-ha!ha!ha!, Foo
a=ARRAY=moo-ha!ha!ha!, Foo

c=main=HASH(0x80cc304), main
b=main=HASH(0x80cc304), main
Segmentation fault
======================================================================

  On another machine :
======================================================================
etienne@isr: uname -a ; perl -v ; perl stringify.pl 
OSF1 isr.isr.ist.utl.pt V4.0 1229 alpha

This is perl, version 5.003_21

Copyright 1987-1997, Larry Wall

        + suidperl security patch
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

a=HASH(0x140019868), HASH

b=ARRAY=moo-ha!ha!ha!, Foo
a=ARRAY=moo-ha!ha!ha!, Foo

c=main=HASH(0x140019868), main
b=main=HASH(0x140019868), main
Operation `.': no method found,
        left argument has no overloaded magic,
        right argument in overloaded package main at stringify.pl line 27.
======================================================================
  
  
[Please do not change anything below this line]
-----------------------------------------------------------------

---
Site configuration information for perl 5.00503:

Configured by randolph at Sat Jan 22 10:22:49 MST 2000.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=linux, osvers=2.3.39, archname=i386-linux
    uname='linux samwise.tausq.org 2.3.39 #1 smp wed jan 12 05:59:50 mst 2000 i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2 ', gccversion=2.95.2 19991109 (Debian GNU/Linux)
    cppflags='-Dbool=char -DHAS_BOOL -D_REENTRANT -DDEBIAN -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -D_REENTRANT -DDEBIAN -I/usr/local/include'
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    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 5.00503:
    /usr/lib/perl5/5.005/i386-linux
    /usr/lib/perl5/5.005
    /usr/local/lib/site_perl/i386-linux
    /usr/local/lib/site_perl
    /usr/lib/perl5
    .

---
Environment for perl 5.00503:
    HOME=/home/etienne
    LANG (unset)
    LANGUAGE (unset)
    LC_CTYPE=pt_PT
    LD_LIBRARY_PATH=/usr/X11R6/lib/:/usr/openwin/lib
    LOGDIR (unset)
    PATH=.:/home/etienne/bin:/home/etienne/prog/bash:/home/etienne/prog/perl/scripts:/home/etienne/prog/perl/mail2:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/sbin:/usr/sbin:/usr/games:/usr/games/bin:/usr/local/MuPAD/share/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

Thread Previous | Thread Next


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