[comp.lang.perl] Short core dump file produced

awilcox@eagle.wesleyan.edu (12/03/90)

I have a Perl program that I leave running in a window, which wakes up
every 30 seconds and reports on how much disk space I have left and
who is on the system.  Once in a blue moon Perl has a segmentation
fault and core dumps.

The strange thing about this is that the core file is short (and gdb
complains about not being able to read things from the file):

$ ls -l core
-rw-r--r--   1 andrew   astro        8192 Dec  2 10:22 core

I checked, and the core file really does come from Perl:

$ strings core
    ...
$Header: perly.c,v 3.0.1.8 90/10/16 10:14:20 lwall Locked $
Patch level: 37
    ...

I wonder what could cause only part of the core file to be written?  I
have lots of free disk space (16meg) on the local file system the core
file is written out to.

This happened twice, and the other core file was only 8K too.

This is a Sparcstation 1, and I'm using Perl @ PL37 compiled with gcc
version 1.36.

Here is the Perl program, "watch":

#!/data1/andrew/bin/perl
while (1) {
	system( "clear" );
	%users = ();
	$_ = `users`;
	for $user (split)
	  {	
	    $users{$user} = '';
	  }
	open( USERS, "ps -aux|" );
	while (<USERS>)
	  {
	    ($user) = split;
	    $users{$user} = '' if $user ne 'USER';
	  }
	close( USERS );
	for $user (sort(keys(%users)))
	  {
            print "$user ";
          }
        print "\n";

	system( "mail -e" );
	if (system("mail -e") >> 8) {
		print "\n";
	}
	else {
		print "*** Mail ***\n";
	}
	print "\n";

	open(F,"df|");
	while (<F>) {
		print $_ if m./dev/sd0g.;
		print $_ if m./data1.;
	}
	close(F);

	system( "pstat -s" );

	sleep(30);
}


I run it from an xterm window:

xterm -title Watch -g 65x7+115+0 -fn 6x10 -e watch &


I thought maybe when xterm terminated, that would somehow stop the
rest of the core file from being written.  But I tried this with a
Perl program that killed itself, and a normal core file was produced.

Any thoughts?

Andrew Wilcox
Department of Astronomy & Astrophysics, Pennsylvania State University
(andrew@astro.psu.edu)