Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site allegra.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!jpl From: jpl@allegra.UUCP (John P. Linderman) Newsgroups: net.bugs.4bsd,net.unix-wizards Subject: How to make make make a core (under 4.2) Message-ID: <2917@allegra.UUCP> Date: Fri, 23-Nov-84 15:22:40 EST Article-I.D.: allegra.2917 Posted: Fri Nov 23 15:22:40 1984 Date-Received: Sat, 24-Nov-84 02:48:43 EST Distribution: net.bugs.4bsd,net.unix-wizards Organization: AT&T Bell Laboratories, Murray Hill Lines: 55 SYNOPSIS: 4.2 /bin/make can drop cores for targets with embedded /'s REPEAT BY: Put the following two lines into a Makefile and do a make -nd: ./core.o: echo $* I get: doname(./core.o,0) sh: 3664 Memory fault - core dumped FIX BY: The problem is in doname.c, where someone evidently mistook the C rindex function (which returns a character pointer) for the fortran rindex function (which returns an integer). Both main.c and doname.c also can be made to dereference NULL depname pointers and thereby drop other cores. The diffs below correct several of these (some of which I had reported earlier) as well as the rindex botch. RCS file: main.c,v retrieving revision 1.1 diff -r1.1 main.c 249c249 < if(! unequal(p, dp->depname->namep)) --- > if((dp->depname != NULL) && ! unequal(p, dp->depname->namep)) RCS file: doname.c,v retrieving revision 1.1 diff -r1.1 doname.c 28a29 > char *pfxfile; 30c31 < char *mkqlist(); --- > char *mkqlist(), *rindex(); 77a79 > if (q->depname == NULL) continue; 121a124 > if (suffp->depname == NULL) continue; 128a132 > if (suffp1->depname == NULL) continue; 145c149,153 < setvar("*", &prefix[rindex(prefix, '/')]); --- > /* setvar("*", &prefix[rindex(prefix, '/')]); */ > if((pfxfile=rindex(prefix, '/')) == NULL) > pfxfile=prefix; > else pfxfile++; > setvar("*", pfxfile); 284a293 > if (q->depname == NULL) return; John P. Linderman Make-it-AND-Break-it Department allegra!jpl