bug in 4.2 /bin/make

John P. Linderman jpl at allegra.UUCP
Fri Aug 24 03:03:19 AEST 1984


SYSNOPSIS:
    make sometimes dumps core with a memory fault or segmentation fault

REPEAT BY:
    Turn the following four lines into a makefile, and run make -nd
	foo:main.o
		cc main.o -o foo

	main.o:a/*.h

    When I do it, I get
	doname(foo,0)
	doname(main.o,1)
	sh: 24665 Memory fault - core dumped
    
    Neither the -n nor the -d are essential to generate the dump.
    The bug seems to depend on the presence of the directory reference
    in the dependency for main.o.

FIX:
    A quick runthrough with a version of make made with -g revealed that
    function expand() in file /usr/src/bin/make/doname.c was being invoked
    with a NULL depname pointer.  I didn't dig into the code to determine
    how the NULL pointer got to expand(), but adding the following check
    to expand() around lines 282-287 eliminates the core dumping and causes
    make to operate correctly.

	--- 282,288 -----
	  char *s1;
	  struct depblock *p, *srchdir();
	  
	+ if (q->depname == NULL) return;
	  s1 = q->depname->namep;
	  for(s=s1 ; ;) switch(*s++)
		{

John P. Linderman  Break Make Department  allegra!jpl



More information about the Comp.bugs.4bsd.ucb-fixes mailing list