nagel@buckaroo.ICS.UCI.EDU (Mark Nagel) (11/27/90)
I am using Tom Christianson's latest man program and under patchlevel 41, on Sun 4/OS 4.03 systems, dbm access in that program causes perl to dump core. Note that this does not happen under OS 4.1, or any other hardware/OS combination I have access to. Has anyone else seen this behavior? I reported this to Larry, but I can't seem to isolate the problem enough to help him track it down... I'm trying to write some small scripts that cause identical crashes, but for now I'm wondering if I'm the only one and more importantly, if someone has found a fix for this. Mark Nagel UC Irvine Department of ICS +----------------------------------------+ ARPA: nagel@ics.uci.edu | Defend your right to arm bears. | UUCP: ucbvax!ucivax!nagel +----------------------------------------+
tchrist@convex.COM (Tom Christiansen) (11/28/90)
In article <25213.659656454@buckaroo.ics.uci.edu> nagel@ICS.UCI.EDU writes: >I am using Tom Christianson's latest man program and under s/son/sen >patchlevel 41, on Sun 4/OS 4.03 systems, dbm access in that program >causes perl to dump core. Note that this does not happen under OS >4.1, or any other hardware/OS combination I have access to. Has >anyone else seen this behavior? I reported this to Larry, but I >can't seem to isolate the problem enough to help him track it >down... I'm trying to write some small scripts that cause identical >crashes, but for now I'm wondering if I'm the only one and more >importantly, if someone has found a fix for this. I am running 4.0.3, but not PL41 on the Suns, and I've not seen the problem. It could be sun's ndbm routines, or perl's assoc array binding thereof, or the weirdness I use to eval the array name to pull the right stuff. I may try to upgrade this weekend, at which point I'll tell you whether I see the problem as well. Do you have problems with any other dbm programs? I'll append three little programmettes that deal with the man stuff: straycats -- find catpages with no parent manpage source catwhatis -- cat out the whatis database(s) countman -- count the number of entries in a man tree The first will work with any man system, the last two expect to use mine. I'd be interested to hear whether the last two dump core for you, since they deal with the databases as well, although in a more straight-forward manner. --tom #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # countman # straycats # catwhatis # This archive created: Tue Nov 27 18:57:14 1990 export PATH; PATH=/bin:/usr/bin:$PATH echo shar: "extracting 'countman'" '(326 characters)' if test -f 'countman' then echo shar: "will not over-write existing file 'countman'" else sed 's/^ X//' << \SHAR_EOF > 'countman' X#!/usr/local/bin/perl X# X# countman -- count the number of entries in a man tree X X$| = 1; Xfor (split(/:/, shift || $ENV{'MANPATH'} || '/usr/man')) { X dbmopen(%whatis, "$_/whatis", undef) || (warn "$0: dbmopen $_: $!\n",next); X print $_, ': '; X for ($count = 0; each %whatis; $count++) { } X print $count, "\n"; X} SHAR_EOF if test 326 -ne "`wc -c < 'countman'`" then echo shar: "error transmitting 'countman'" '(should have been 326 characters)' fi chmod 775 'countman' fi echo shar: "extracting 'straycats'" '(525 characters)' if test -f 'straycats' then echo shar: "will not over-write existing file 'straycats'" else sed 's/^ X//' << \SHAR_EOF > 'straycats' X#!/usr/local/bin/perl X# X# straycats -- find catpages with no parent manpage source X Xfor $root (split(/:/, shift || $ENV{'MANPATH'} || '/usr/man')) { X X chdir($root) || die "can't chdir to $root: $!\n"; X X foreach $catdir ( <cat*> ) { X opendir (catdir, $catdir) || die "can't opendir $dir: $!"; X ($mandir = $catdir) =~ s/cat/man/; X foreach $file ( readdir(catdir) ) { X next if $file eq '.'; X next if $file eq '..'; X next if -e "$mandir/$file"; X print "no man page for $root/$catdir/$file\n"; X } X } X X} SHAR_EOF if test 525 -ne "`wc -c < 'straycats'`" then echo shar: "error transmitting 'straycats'" '(should have been 525 characters)' fi chmod 775 'straycats' fi echo shar: "extracting 'catwhatis'" '(565 characters)' if test -f 'catwhatis' then echo shar: "will not over-write existing file 'catwhatis'" else sed 's/^ X//' << \SHAR_EOF > 'catwhatis' X#!/usr/local/bin/perl X# X# catwhatis -- cat out the whatis database(s) X Xfor $manroot (split(/:/, shift || $ENV{'MANPATH'} || '/usr/man')) { X if (!dbmopen(manroot, "$manroot/whatis", undef)) { X warn "Can't dbmopen $manroot/whatis: $!\n"; X next; X } X print "$manroot:\n"; X while (($key,$value) = each %manroot) { X for (split(/\002/, $value)) { X if (/\001/) { X ($cmd, $page, $section, $desc) = split(/\001/); X printf "%-30s - %s\n", "$cmd ($section)", $desc; X } else { X printf "%-30s > %s\n", $key, $_; X } X } X } X dbmclose(manroot); X} SHAR_EOF if test 565 -ne "`wc -c < 'catwhatis'`" then echo shar: "error transmitting 'catwhatis'" '(should have been 565 characters)' fi chmod 775 'catwhatis' fi exit 0 # End of shell archive
thurlow@convex.com (Robert Thurlow) (11/28/90)
In <109356@convex.convex.com> tchrist@convex.COM (Tom Christiansen) writes: > straycats -- find catpages with no parent manpage source "Oh for fuck's sake!", as friends of mine used to ungramattically but effectively say and write :-) Rob T -- Rob Thurlow, thurlow@convex.com or thurlow%convex.com@uxc.cso.uiuc.edu ---------------------------------------------------------------------- "This opinion was the only one available; I got here kind of late."
nagel@buckaroo.ics.uci.edu (Mark Nagel) (11/28/90)
In <109356@convex.convex.com> tchrist@convex.COM (Tom Christiansen) writes: >In article <25213.659656454@buckaroo.ics.uci.edu> nagel@ICS.UCI.EDU writes: >I am running 4.0.3, but not PL41 on the Suns, and I've not seen >the problem. It could be sun's ndbm routines, or perl's assoc >array binding thereof, or the weirdness I use to eval the array >name to pull the right stuff. I may try to upgrade this weekend, >at which point I'll tell you whether I see the problem as well. Well, thanks to the following reply I received, everything is working great now. /*****************************************************************************/ From: anders@ifi.uio.no There is a bug in BSD ndbm.c, which may cause random overwrite of memory. We found it ourself when we started to use tchrist's man. Thanks to obh@usit.uio.no for locating the problem. *** bsd/lib/libc/gen/ndbm.c Tue Nov 27 12:46:46 1990 --- ../bsd/lib/libc/gen/ndbm.c Mon Nov 26 19:34:49 1990 *************** *** 519,525 **** if (i2 > 0) i1 = sp[i2]; i1 -= item.dsize + item1.dsize; ! if (i1 <= (i2+3) * sizeof(short)) return (0); sp[0] += 2; sp[++i2] = i1 + item1.dsize; --- 520,526 ---- if (i2 > 0) i1 = sp[i2]; i1 -= item.dsize + item1.dsize; ! if (i1 < 0 || i1 <= (i2+3) * sizeof(short)) return (0); sp[0] += 2; sp[++i2] = i1 + item1.dsize; Here is the cvs comment: revision 1.3 date: 90/11/24 18:42:16; author: obh; state: Exp; lines added/del: 4/3 ---------------------------------------------------------------------- Fixed a ANSI C bug; signed int get converted to unsigned int in ANSI C. (-1 < sizeof(short)) is not true in ANSI C. /*****************************************************************************/ I just grabbed the latest ndbm sources from uunet's bsd-sources directory and used them straight (the bug has been repaired in the latest version). Apparently, this random stomping of memory didn't interact badly enough with perl until pl41! -- Mark Nagel UC Irvine Department of ICS +----------------------------------------+ ARPA: nagel@ics.uci.edu | Help! Somebody! I'm being repressed! | UUCP: ucbvax!ucivax!nagel +----------------------------------------+