Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!ugle.unit.no!isolde!hta From: harald.alvestrand@elab-runit.sintef.no Newsgroups: comp.lang.perl Subject: PERL dumps core on s/// the third time???? Message-ID: <1991Mar4.130949.6450@ugle.unit.no> Date: 4 Mar 91 13:09:49 GMT Sender: news@ugle.unit.no Reply-To: harald.alvestrand@elab-runit.sintef.no Organization: ELAB-RUNIT, SINTEF, Norway Lines: 114 May all the net.gods rise up and strike me...here is a bug I found in hoary old perl version 3.0, patch level 37: Given the following stuff, PERL will core dump on a Sun-4/490 running SunOS 4.0.3, if the command line is perl bug.perl bug.translate bug.sum It attempts to EVAL several s-expressions. Everything seems critical. The bug in the original program was the check for comment lines, but still, PERL should not core dump on me, should it???? BTW: it coredumps on perl -d and "c", but does NOT coredump when I single-step through the whole program. Sounds rather random. The stuff below is SHAR.... Harald Tveit Alvestrand Harald.Alvestrand@elab-runit.sintef.no C=no;PRMD=uninett;O=sintef;OU=elab-runit;S=alvestrand;G=harald +47 7 59 70 94 #! /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 'bug.perl' <<'END_OF_FILE' X#!/local/bin/perl X X# This is the program.... Xif ($#ARGV < 0) { die "Usage: $0 renamefile minmsg\n"; } X$deffile = shift(@ARGV); X Xopen( DEFINITION, $deffile) || die "Could not open $deffile\n"; Xwhile () { X chop; X if (/[^#]*\//) { # Respect the hash, and only parse lines with slash before X s/\s*\#.*$//; # Remove end-of-line comments X ($pattern, $to) = split('/'); X push(@patterns, $pattern); X push(@tos, $to); X } X} Xclose DEFINITION; X Xwhile (<>) { X @splitline = split(" "); X $dom = $splitline[0]; X $dom =~ tr/A-Z/a-z/; X $dom = &simplify($dom); X} X Xsub simplify { X local($dom) = @_; X # Try each of the patterns listed, in order X loop: for $index (0..$#patterns) { X $expr = "\$dom =~ s/$patterns[$index]/$tos[$index]/"; X print "$expr\n"; X $status = eval $expr; X if ($@) { X die "Eval of $expr failed, status $@\n"; X } X print "OK\n"; X if ($status) { last loop; } X } X $dom; X} END_OF_FILE if test 985 -ne `wc -c <'bug.perl'`; then echo shar: \"'bug.perl'\" unpacked with wrong size! fi chmod +x 'bug.perl' # end of 'bug.perl' fi if test -f 'bug.sum' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'bug.sum'\" else echo shar: Extracting \"'bug.sum'\" \(90 characters\) sed "s/^X//" >'bug.sum' <<'END_OF_FILE' XLIST-REDISTRIBUTION@SINTEF.NO 4 6914 0 0 0 0 XC=NO;O=UIB;OU=IFI;S=TUFTEDAL 0 0 1 372 1 372 END_OF_FILE if test 90 -ne `wc -c <'bug.sum'`; then echo shar: \"'bug.sum'\" unpacked with wrong size! fi # end of 'bug.sum' fi if test -f 'bug.translate' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'bug.translate'\" else echo shar: Extracting \"'bug.translate'\" \(101 characters\) sed "s/^X//" >'bug.translate' <<'END_OF_FILE' X# Oversettelsesfil for opptelling av O/R navn X^c=no;o=([^;]*);.*/Inet-NO $1 X.*@.*/Gamle EAN adresser END_OF_FILE if test 101 -ne `wc -c <'bug.translate'`; then echo shar: \"'bug.translate'\" unpacked with wrong size! fi # end of 'bug.translate' fi echo shar: End of shell archive. exit 0