ruba@molbio.ethz.ch (Rudolf Baumann) (01/09/91)
I have gotten a database file from a Mac from which I want to make a nice printout with perl using formatted output. I can't find out why this simple program runs for the first five record and then dumps core. On a Sun4 the message is 'Segmentation fault' in csh and 'memory fault' in sh. (On a Sun3 it gives a 'Bus error'). The output of perl -v is: >This is perl, version 3.0 >$Header: perly.c,v 3.0.1.9 90/11/10 01:53:26 lwall Locked $ >Patch level: 41 The program: #!/usr/bin/perl # format STDOUT = Titel: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $titel ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $titel Authors: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $author ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $author Journal: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< $journal, $year . open(IN2, "dbfile"); $/ = ''; while (<IN2>) { @db = split('\|'); for ($i=3;$i<8;$i++) { $db[$i] =~ s/\n....//; $db[$i] =~ s/\n / /g; $db[$i] =~ s/ / /g; } $titel = $db[3]; $author = $db[4]; $journal = $db[6]; $year = $db[7]; write; } # --------------------------------------------------------------------------- and the dbfile looks like this: --------------------------------------------------------------------------- 1/4/1 FN- CURRENT CONTENTS ON DISKETTE| DT- Article| AN- BR86J| TI- Thyroid Peroxidase Autoantigen - Localization of Autoantigenic Epitopes on Recombinant Protein and Prediction of Secondary Structure.| AU- Banga, J.P.; Ewins, D.L.; Barnett, P.S.; Tomlinson, R.W.S.; Mahadevan, D.; Barton, G.J.; Sutton, B.J.; Saldanha, J.W.; Odell, E.; Mcgregor, A.M.| CS- JP Banga, Univ London Kings Coll, Sch Med, Dept Med, London WC2R 2LS, England| JN- Thyroperoxidase and Thyroid A; 207 () p351-358| PY- 1990| LA- English| 1/4/2 FN- CURRENT CONTENTS ON DISKETTE| DT- Article| AN- EH672| TI- Evidence for RNA-Oligonucleotides in Plant Vacuoles Isolated from Cultured Tomato Cells.| AU- Abel, S.; Blume, B.; Glund, K.| CS- S Abel, Martin Luther Univ, Sekt Biowissensch, Wissensch Bereich Biochem, Pflanzenbiochem ABT, Neuwerk 1, DDR-4020 Halle, Ger Dem Rep| JN- Plant Physiol; 94 (3) p1163-1171| PY- NOV-1990| LA- English| . . . --------------------------------------------------------------------------- The output looks like this: . . . Titel: Purification, Characterization, and Immunological Properties for 2 Isoforms of Glutathione Reductase from Eastern White Pine Needles. Authors: Anderson, J.V.; Hess, J.L.; Chevone, B.I. Journal: Plant Physiol; 94 (3) p1402-1409 NOV-1990 Titel: The Role of Inhibition of Pyruvate Kinase in the Stimulation of Gluconeogenesis by Glucagon - A Reevaluation. Authors: Haynes, R.C.; Picking, R.A. Journal: Arch Biochem Biophys; 283 (1) p51-59 NOV 15-1990 Titel: The Transition of the Higher-Order Structure of Rat Liver Chromatin Takes Place At About 85-Percent Neutralization of DNA Charges. Authors: Watanabe, F. Journal: Biochem Biophys Res Commun; 172 (3) p1129-1131 NOV 15-1990 Segmentation fault a printout without write (using only print) works on the whole file! Thank you Ruedi -- Rudolf E. Baumann ruba@molbio.ethz.ch Institut fuer Molekularbiologie & Biophysik ETH Hoenggerberg (HPM G6) MOLEKULA@CZHETH5A.bitnet CH-8093 Zuerich/Switzerland Tel. ++41 1 377 33 97
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (01/10/91)
In article <6626@biophys.zir.ethz.ch> ruba@molbio.ethz.ch (Rudolf Baumann) writes:
: I have gotten a database file from a Mac from which I want to make a
: nice printout with perl using formatted output. I can't find out why
: this simple program runs for the first five record and then dumps core.
It's difficult to tell without all the input data, but it's very likely
this has been fixed in patch 42, which will come out shortly. In fact,
patchlevel 42 is going to be very close to version 4.0, modulo a bit of
repackaging and maybe a bug fix or two.
Larry
ruba@molbio.ethz.ch (Rudolf Baumann) (01/10/91)
ruba@molbio.ethz.ch (Rudolf Baumann) writes: >I have gotten a database file from a Mac from which I want to make a >nice printout with perl using formatted output. I can't find out why >this simple program runs for the first five record and then dumps core. In the mean time I found out, that the same program with the same data set runs on an Ultrix system, it even runs on a Sun, but only with SunOS 4.1. On our systems which currently run 4.0.3 the program dumps core regardless of the (Sun) machine type. Ruedi -- Rudolf E. Baumann ruba@molbio.ethz.ch Institut fuer Molekularbiologie & Biophysik ETH Hoenggerberg (HPM G6) MOLEKULA@CZHETH5A.bitnet CH-8093 Zuerich/Switzerland Tel. ++41 1 377 33 97
worley@compass.com (Dale Worley) (01/11/91)
From: ruba@molbio.ethz.ch (Rudolf Baumann) #!/usr/bin/perl # format STDOUT = [etc.] . I cut out the program and ran it, and discovered a funny thing: Mailers sometimes turn lines that consist of '.' alone into '. ', but Perl doesn't accept trailing whitespace on the '.' that terminates a format! The patch below fixes this. (Whitespace is still not allowed *before* the '.', but that's visible.) Also, if you want advice on finding a bug, you should include the input that crashes the program. In this case, the record that the program is processing when it crashes isn't shown in the article! *** toke.c.orig Thu Jan 10 10:39:27 1991 --- toke.c Thu Jan 10 10:44:59 1991 *************** *** 2356,2364 **** str_nset(tmpstr, s, eol-s); astore(stab_xarray(curcmd->c_filestab), (int)curcmd->c_line,tmpstr); } ! if (strnEQ(s,".\n",2)) { ! bufptr = s; ! return froot.f_next; } if (*s == '#') { s = eol; --- 2356,2368 ---- str_nset(tmpstr, s, eol-s); astore(stab_xarray(curcmd->c_filestab), (int)curcmd->c_line,tmpstr); } ! if (*s == '.') { ! for (t = s+1; *t == ' ' || *t == '\t'; t++) ! /* empty */ ; ! if (strnEQ(t,"\n",1)) { ! bufptr = s; ! return froot.f_next; ! } } if (*s == '#') { s = eol; Dale Worley Compass, Inc. worley@compass.com -- Democracy attempts to upset nothing, but only to facilitate the potential upset of anything.