How to make make make a core (under 4.2)

John P. Linderman jpl at allegra.UUCP
Sat Nov 24 06:22:40 AEST 1984


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



More information about the Comp.unix.wizards mailing list