strange core dump on die conditional on negated pattern match 
Author Message
 strange core dump on die conditional on negated pattern match

I'm getting the following core dump when running the attached perl script
fragment with the attached data fragment thus:

  % frag.pl < frag.data

The core dump occurs on the second iteration of the loop checking for
presence of 'required' fields in a data file.

-- frag.pl
#! /usr/local/bin/perl
#
$opt_delimiter = "~" if(!$opt_delimiter);

 'WELLID',
 'FIELD',
 'BLOCK',
 'PLATFORM',
 'WELL',
 'START',
 'END',
 'TABLES'
);
$HDR_FIELD_LIST = &BangLine2FieldList(*STDIN,$opt_delimiter);

  die "$hdr not found" if( $HDR_FIELD_LIST !~ /$hdr/ );

Quote:
}

# will read forward to find a bang line
# creates a perl-ish list of variable names using field names found in
# bang line

sub BangLine2FieldList {

  local( $first_line, $first_char) = '';
  do {
     $_ = <file> if (!/^!/);
     /(.)(.*)/;
     $first_char = $1;
     $first_line = $2;
  } until ($first_char eq '!' || eof(file));

  if (eof(file)) {
     die "no ! line in $file";
  }
  $varlist = '$'.join( ', $', split( /$delimit/, $first_line));
  return($varlist);

Quote:
}

-- frag.data
!WELLID~FOO~BLOCK~PLATFORM~WELL~START~END~TABLES
3~Anschutz Range~1522~UR #19~99~1992/9/2~1992/9/2~FOO,BAR
--
This is perl, version 4.0

$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36

--
GDB 4.4, Copyright 1991 Free Software Foundation, Inc.

Program received signal 11, Segmentation fault
0xf773235c in strlen ()
(gdb) bt
#0  0xf773235c in strlen ()
#1  0x2f284 in str_set ()
#2  0x3c35c in mess ()
#3  0x3c4e8 in Myfatal ()
#4  0x1f688 in eval ()
#5  0x4444 in cmd_exec ()
#6  0x49f4 in cmd_exec ()
#7  0x26afc in main ()
--

DRD Corp., 5506 South Lewis Ave., Tulsa, OK 74105         (918)745-9037 fax



Sat, 09 Sep 1995 04:03:53 GMT  
 strange core dump on die conditional on negated pattern match

Quote:

>I'm getting the following core dump when running the attached perl script
>fragment with the attached data fragment thus:

>  % frag.pl < frag.data

>The core dump occurs on the second iteration of the loop checking for
>presence of 'required' fields in a data file.

in other words, it is core dumping on a 'die' (or warn), reliably.

I had just upgraded to pl36 and hadn't bothered to run the tests.
When i do, I get:

base/cond......ok
base/if........ok
base/lex.......ok
base/pat.......ok
base/term......ok
comp/cmdopt....ok
comp/cpp........21745.c:10: unterminated string or character constant
ok
comp/decl......ok
comp/multiline.ok
comp/package...ok
comp/script....ok
comp/term......ok
cmd/elsif......ok
cmd/for........ok
cmd/mod........ok
cmd/subval.....ok
cmd/switch.....ok
cmd/while......ok
io/argv........ok
io/dup.........ok
io/fs..........ok
io/inplace.....ok
io/pipe........ok
io/print.......ok
io/tell........ok
op/append......ok
op/array.......ok
op/auto........ok
op/chop........ok
op/cond........ok
op/dbm.........ok
op/delete......ok
op/do..........ok
op/each........ok
op/eval........FAILED on test 0
op/exec........ok
op/exp.........ok
op/flip........ok
op/fork........ok
op/glob........ok
op/goto........ok
op/groups......ok
op/index.......ok
op/int.........ok
op/join........ok
op/list........ok
op/local.......ok
op/magic.......ok
op/mkdir.......ok
op/oct.........ok
op/ord.........ok
op/pack........ok
op/pat.........ok
op/push........ok
op/range.......ok
op/read........ok
op/readdir.....ok
op/regexp......FAILED on test 45
op/repeat......ok
op/s...........ok
op/sleep.......ok
op/sort........ok
op/split.......ok
op/sprintf.....ok
op/stat........ok
op/study.......ok
op/substr......ok
op/time........ok
op/undef.......ok
op/unshift.....ok
op/vec.........ok
op/write.......ok
lib/big........ok
Segmentation fault (core dumped)

Everything's compiled with gcc 2.2.2, running on SunOS 4.1.1.
my config.sh is:
--
#!/bin/sh
# config.sh
# This file was produced by running the Configure script.
d_eunice='undef'
define='define'
eunicefix=':'
loclist='
cat
cp
echo
expr
grep
mkdir
mv
rm
sed
sort
tr
uniq
'
expr='/bin/expr'
sed='/bin/sed'
echo='/bin/echo'
cat='/bin/cat'
rm='/bin/rm'
mv='/bin/mv'
cp='/bin/cp'
tail=''
tr='/bin/tr'
mkdir='/bin/mkdir'
sort='/bin/sort'
uniq='/bin/uniq'
grep='/bin/grep'
trylist='
Mcc
bison
cpp
csh
egrep
line
nroff
perl
test
uname
yacc
'
test='test'
inews=''
egrep='/bin/egrep'
more=''
pg=''
Mcc='Mcc'
vi=''
mailx=''
mail=''
cpp='/usr/lang/cpp'
perl='/usr/local/bin/perl'
emacs=''
ls=''
rmail=''
sendmail=''
shar=''
smail=''
tbl=''
troff=''
nroff='/bin/nroff'
uname='/bin/uname'
uuname=''
line='/bin/line'
chgrp=''
chmod=''
lint=''
sleep=''
pr=''
tar=''
ln=''
lpr=''
lp=''
touch=''
make=''
date=''
csh='/bin/csh'
bash=''
ksh=''
lex=''
flex=''
bison='/usr/local/bin/bison'
Log='$Log'
Header='$Header'
Id='$Id'
lastuname='SunOS tierra 4.1.1 8 sun4c'
alignbytes='8'
bin='/usr/local/bin'
installbin='/usr/local/bin'
byteorder='4321'
contains='grep'
cppstdin='cppstdin'
cppminus=''
d_bcmp='define'
d_bcopy='define'
d_safebcpy='define'
d_bzero='define'
d_castneg='define'
castflags='0'
d_charsprf='define'
d_chsize='undef'
d_crypt='define'
cryptlib=''
d_csh='define'
d_dosuid='undef'
d_dup2='define'
d_fchmod='define'
d_fchown='define'
d_fcntl='define'
d_flexfnam='define'
d_flock='define'
d_getgrps='define'
d_gethent='define'
d_getpgrp='define'
d_getpgrp2='undef'
d_getprior='define'
d_htonl='define'
d_index='undef'
d_isascii='define'
d_killpg='define'
d_lstat='define'
d_memcmp='define'
d_memcpy='define'
d_safemcpy='undef'
d_memmove='undef'
d_memset='define'
d_mkdir='define'
d_msg='define'
d_msgctl='define'
d_msgget='define'
d_msgrcv='define'
d_msgsnd='define'
d_ndbm='define'
d_odbm='define'
d_open3='define'
d_readdir='define'
d_rename='define'
d_rewindir='define'
d_rmdir='define'
d_seekdir='define'
d_select='define'
d_sem='define'
d_semctl='define'
d_semget='define'
d_semop='define'
d_setegid='define'
d_seteuid='define'
d_setpgrp='define'
d_setpgrp2='undef'
d_setprior='define'
d_setregid='define'
d_setresgid='undef'
d_setreuid='define'
d_setresuid='undef'
d_setrgid='define'
d_setruid='define'
d_shm='define'
d_shmat='define'
d_voidshmat='undef'
d_shmctl='define'
d_shmdt='define'
d_shmget='define'
d_socket='define'
d_sockpair='define'
d_oldsock='undef'
socketlib=''
d_statblks='define'
d_stdstdio='define'
d_strctcpy='define'
d_strerror='undef'
d_symlink='define'
d_syscall='define'
d_telldir='define'
d_truncate='define'
d_vfork='define'
d_voidsig='define'
d_tosignal='int'
d_volatile='define'
d_vprintf='define'
d_charvspr='define'
d_wait4='define'
d_waitpid='define'
gidtype='gid_t'
groupstype='int'
i_fcntl='undef'
i_gdbm='undef'
i_grp='define'
i_niin='define'
i_sysin='undef'
i_pwd='define'
d_pwquota='undef'
d_pwage='define'
d_pwchange='undef'
d_pwclass='undef'
d_pwexpire='undef'
d_pwcomment='define'
i_sys_file='define'
i_sysioctl='define'
i_time='undef'
i_sys_time='define'
i_sys_select='undef'
d_systimekernel='undef'
i_utime='define'
i_varargs='define'
i_vfork='define'
intsize='4'
libc='/usr/lib/libc.so.1.7'
nm_opts=''
libndir=''
i_my_dir='undef'
i_ndir='undef'
i_sys_ndir='undef'
i_dirent='define'
i_sys_dir='undef'
d_dirnamlen='undef'
ndirc=''
ndiro=''
mallocsrc='malloc.c'
mallocobj='malloc.o'
d_mymalloc='define'
mallocptrtype='char'
mansrc='/usr/man/manl'
manext='l'
models='none'
split=''
small=''
medium=''
large=''
huge=''
optimize='-O'
ccflags='-fpcc-struct-return -traditional -Dvolatile=__volatile__ -I/usr/include/sun -I/usr/ucbinclude'
cppflags=' -traditional -Dvolatile=__volatile__ -I/usr/include/sun -I/usr/ucbinclude -D__GNUC__'
ldflags=''
cc='gcc'
nativegcc='undef'
libs='-ldbm -lm -lposix'
n='-n'
c=''
package='perl'
randbits='31'
scriptdir='/usr/local/script'
installscr='/usr/local/script'
sig_name='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP TSTP CONT CLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH LOST USR1 USR2'
spitshell='cat'
shsharp='true'
sharpbang='#!'
startsh='#!/bin/sh'
stdchar='unsigned char'
uidtype='uid_t'
usrinclude='/usr/include'
inclPath=''
void=''
voidhave='7'
voidwant='7'
w_localtim='1'
w_s_timevl='1'
w_s_tm='1'
yacc='/bin/yacc'
lib=''
privlib='/usr/local/lib/perl'
installprivlib='/usr/local/lib/perl'
PATCHLEVEL=36
CONFIG=true

--

DRD Corp., 5506 South Lewis Ave., Tulsa, OK 74105         (918)745-9037 fax



Sat, 09 Sep 1995 05:01:23 GMT  
 strange core dump on die conditional on negated pattern match
I've rebuilt perl using stock sun cc and all tests pass so gcc 2.2.2
was the source of the error.  The code fragment in the head article of
this thread also runs fine.

Does anybody have (by e-mail, please) the correct (if such exists)
invocation of flags & such to use gcc to build perl on SunOS 4.1.1?
--

DRD Corp., 5506 South Lewis Ave., Tulsa, OK 74105         (918)745-9037 fax



Sat, 09 Sep 1995 05:48:35 GMT  
 strange core dump on die conditional on negated pattern match

    Mark> I've rebuilt perl using stock sun cc and all tests pass so
    Mark> gcc 2.2.2 was the source of the error.  The code fragment in
    Mark> the head article of this thread also runs fine.

I just had the same problem with gcc 2.3.3.  Tests comp/cpp, op/eval,
and op/regexp failed while lib/big core dumped.  Rebuilding with
/bin/cc produced a perl which passes all tests.  This is on SS2, SunOS
4.1.1, with perl 4.036.

    Mark> Does anybody have (by e-mail, please) the correct (if such
    Mark> exists) invocation of flags & such to use gcc to build perl
    Mark> on SunOS 4.1.1?

Please post a summary!  Thanks.
-Barry



Sun, 10 Sep 1995 02:57:02 GMT  
 strange core dump on die conditional on negated pattern match

|>

|>
|>     Mark> I've rebuilt perl using stock sun cc and all tests pass so
|>     Mark> gcc 2.2.2 was the source of the error.  The code fragment in
|>     Mark> the head article of this thread also runs fine.
|>
|> I just had the same problem with gcc 2.3.3.  Tests comp/cpp, op/eval,
|> and op/regexp failed while lib/big core dumped.  Rebuilding with
|> /bin/cc produced a perl which passes all tests.  This is on SS2, SunOS
|> 4.1.1, with perl 4.036.
|>
|>     Mark> Does anybody have (by e-mail, please) the correct (if such
|>     Mark> exists) invocation of flags & such to use gcc to build perl
|>     Mark> on SunOS 4.1.1?
|>
|> Please post a summary!  Thanks.
|> -Barry
I have compiled perl on SunOS 4.1.1 with gcc 2.3.3 with no problems,
this is from my config.sh:

cpp='/usr/lib/cpp'
models='none'
split=''
small=''
medium=''
large=''
huge=''
optimize='-O'
ccflags='-Dvolatile=__volatile__ -fpcc-struct-return'
cppflags=' -Dvolatile=__volatile__'
ldflags=''
cc='gcc'
nativegcc='define'
libs='-lnsl -ldbm -lm -lposix'

It is basically the default responses to Configure except that I took
out the -I's in the ccflags and added the -fpcc...

--

Michael Salmon

#include        <standard.disclaimer>
#include        <witty.saying>
#include        <fancy.pseudo.graphics>

Ericsson Telecom AB
Stockholm



Mon, 11 Sep 1995 21:16:29 GMT  
 strange core dump on die conditional on negated pattern match

Quote:


> /bin/cc produced a perl which passes all tests.  This is on SS2, SunOS
> 4.1.1, with perl 4.036.

>     Mark> Does anybody have (by e-mail, please) the correct (if such
>     Mark> exists) invocation of flags & such to use gcc to build perl
>     Mark> on SunOS 4.1.1?

Along similar lines, does anyone know how to build on SunOS 4.1.3, SPARCstation 10
with SunPro's C compiler "acc" v2.0.1?

kevin
---
kevin samborn
sakura global capital



Tue, 12 Sep 1995 02:22:56 GMT  
 strange core dump on die conditional on negated pattern match

Quote:

>|>     Mark> I've rebuilt perl using stock sun cc and all tests pass so
>|>     Mark> gcc 2.2.2 was the source of the error.  The code fragment in
>|>     Mark> the head article of this thread also runs fine.
>|>
>|> I just had the same problem with gcc 2.3.3.  Tests comp/cpp, op/eval,
>|> and op/regexp failed while lib/big core dumped.  Rebuilding with
>|> /bin/cc produced a perl which passes all tests.  This is on SS2, SunOS
>|> 4.1.1, with perl 4.036.
>|>
>|>     Mark> Does anybody have (by e-mail, please) the correct (if such
>|>     Mark> exists) invocation of flags & such to use gcc to build perl
>|>     Mark> on SunOS 4.1.1?
>|>
>|> Please post a summary!  Thanks.
>I have compiled perl on SunOS 4.1.1 with gcc 2.3.3 with no problems,
>this is from my config.sh:

>cpp='/usr/lib/cpp'
>models='none'
>optimize='-O'
>ccflags='-Dvolatile=__volatile__ -fpcc-struct-return'
>cppflags=' -Dvolatile=__volatile__'
>ldflags=''
>cc='gcc'
>nativegcc='define'
>libs='-lnsl -ldbm -lm -lposix'

>It is basically the default responses to Configure except that I took
>out the -I's in the ccflags and added the -fpcc...

Speaking of build problems ...

I'm trying to build perl 4.036 on a Sun IPC running SunOS 4.1.3.  My config.sh
sez

cpp='/usr/lib/cpp'
models='none'
optimize='-O2'
ccflags='-fpcc-struct-return -traditional -Dvolatile=__volatile__ -I/usr/include/sun -I/usr/ucbinclude'
cppflags=' -traditional -Dvolatile=__volatile__ -I/usr/include/sun -I/usr/ucbinclude -D__GNUC__'
ldflags=''
cc='gcc'
nativegcc='undef'
libs='-ldbm -lm'

I'm using gcc 2.3.3 as well.

Using "-O2" causes the "./perl installperl" stage to dump core; "mess()" is
calling a "strlen()" which seems to be the culprit.

Changing it to "-g" causes the make to work, but the check for whether
"make test" has been done in "installperl" seems to choke:

./perl installperl
 at installperl line 54.

Line 54 of "installperl" is

-x 't/TEST'             || warn "WARNING: You've never run 'make test'!!!",

(I hadn't run "make test", btw).

Any ideas?

Thanks in advance,

--
        - Greg Earle
          Phone: (818) 353-8695         FAX: (818) 353-1877




Tue, 19 Sep 1995 06:53:07 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. perl5.001m/n: eval/sig/die core dump

2. Strange core dump under sunos-4.1.3, running 4.1.x binary

3. strange core dumping ARGV behaviour

4. perl dumps core on alpha with @ as pattern in split

5. loops, conditional expressions, and pattern match variables

6. Pattern matching with conditional replace

7. $SIG{__DIE__} vs *CORE::GLOBAL::die

8. PERLFUNC: dump - create an immediate core dump

9. PERLFUNC: dump - create an immediate core dump

10. How to negate a pattern ?

11. Negating (and retaining match) of a regular expression

12. perl5a9: Bug - tie + die + eal = core

 

 
Powered by phpBB® Forum Software