marcl@ESD.3Com.COM (Marc Lavine) (03/14/91)
I've found that using "undef" on an element of an associative array can cause Perl 4.0.beta to dump core (not neccessarily immediately). I'm enclosing a short script (albeit somewhat strange) that should allow others to confirm this. I've run it on a SPARCstation SLC under SunOS 4.1.1. This script does not dump core under Perl 3.0.37 or 3.0.44. Marc Lavine #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: undef.bug.pl # Wrapped by marcl@cook.ESD.3Com.COM on Wed Mar 13 19:46:31 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'undef.bug.pl' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'undef.bug.pl'\" else echo shar: Extracting \"'undef.bug.pl'\" \(403 characters\) sed "s/^X//" >'undef.bug.pl' <<'END_OF_FILE' X#!/usr/local/bin/perl X# X# Demonstrate a bug in Perl 4.0.beta. X# This script works fine under Perl 3.0.37 and 3.0.44. X# Under 4.0.beta, Perl dumps core. X# X X$count = 2; X Xwhile ( $count-- ) X { X open ( INPUT, "undef.bug.pl" ); X X while ( <INPUT> ) X { X $lines { $counter++ } = $_; X undef $lines { $counter }; X } X X while ( --$counter ) X { X undef $lines { $counter }; X } X X close ( INPUT ); X } END_OF_FILE if test 403 -ne `wc -c <'undef.bug.pl'`; then echo shar: \"'undef.bug.pl'\" unpacked with wrong size! fi chmod +x 'undef.bug.pl' # end of 'undef.bug.pl' fi echo shar: End of shell archive. exit 0 -- Marc Lavine Broken: marcl%3Com.Com@sun.com Smart: marcl@3Com.Com UUCP: ...{sun|decwrl}!3Com.Com!marcl
lwall@jpl-devvax.jpl.nasa.gov (Larry Wall) (03/14/91)
In article <marcl.668921376@cook.ESD.3Com.COM> marcl@ESD.3Com.COM (Marc Lavine) writes:
: I've found that using "undef" on an element of an associative array
: can cause Perl 4.0.beta to dump core (not neccessarily immediately).
: I'm enclosing a short script (albeit somewhat strange) that should
: allow others to confirm this. I've run it on a SPARCstation SLC under
: SunOS 4.1.1. This script does not dump core under Perl 3.0.37 or
: 3.0.44.
In eval.c, case O_UNDEF, under the line that says
Safefree(str->str_ptr);
add the two lines
str->str_ptr = Nullch;
str->str_len = 0;
Larry
rbj@uunet.UU.NET (Root Boy Jim) (03/18/91)
In article <1991Mar14.043220.26462@jpl-devvax.jpl.nasa.gov> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
?
?In eval.c, case O_UNDEF, under the line that says
?
? Safefree(str->str_ptr);
?
?add the two lines
?
? str->str_ptr = Nullch;
? str->str_len = 0;
?
?Larry
New patch format? :-)
--
[rbj@uunet 1] stty sane
unknown mode: sane