dale@vicorp.UUCP (Dale Nielsen) (09/08/89)
There is a problem with make-3.55 when it is invoked with the -f option to specify the filename of the makefile. Make writes over the internal makefiles struct so that when it updates a dependent makefile and rexecutes itself part of its new command line (as passed to execvp) is corrupted when the contents of MAKEFLAGS is written on top of it. I stepped through the code with dbx, and it seems that malloc gives out the memory reserved for makefiles->list when it is saving the MAKEFLAGS variable, so somewhere that memory is being erroneously freed. I haven't been able to find out where the problem is exactly, but it wasn't there in 3.48. This sample makefile (named Make.test) demonstrates the bug: ########################## foo : bar include foo.mk foo.mk : bar foo bar foo.mk : touch $@ ######################### % gmake.new -f Make.test -d GNU Make version 3.55, by Richard Stallman and Roland McGrath. [... extra stuff deleted ] Reading makefiles... gmake.new: fopen: foo.mk: No such file or directory Updating makefiles.... Considering target file `foo.mk'. File `foo.mk' does not exist. Considering target file `bar'. Finished dependencies of target file `bar'. No need to remake target `bar'. Finished dependencies of target file `foo.mk'. Must remake target `foo.mk'. touch foo.mk Successfully remade target file `foo.mk'. [... extra stuff deleted ] Considering target file `Make.test'. No need to remake target `Make.test'. Re-execing myself.... GNU Make version 3.55, by Richard Stallman and Roland McGrath. [... extra stuff deleted ] Reading makefiles... gmake.new: fopen: d -S: No such file or directory Updating makefiles.... Considering target file `d -S'. File `d -S' does not exist. Looking for an implicit rule for `d -S'. [... it just gets uglier from here out] Trying implicit dependency `SCCS/s.d -S.sh'. No implicit rule found for `d -S'. Finished dependencies of target file `d -S'. No commands for `d -S' and no dependencies actually changed. No need to remake target `d -S'. gmake.new: No targets. Stop. I haven't found out where this goes wrong yet, but I wanted to make it known. Anybody else seen this? Fixed it???? -- --Dale Nielsen ARPA: dale@vicorp.UU.NET V. I. Corporation UUCP: uunet!vicorp!dale Amherst Research Park PHONE: (413) 253-3482 Amherst, Massachusetts 01002 FAX: (413) 256-0574