URL: <http://savannah.gnu.org/bugs/?50909>
Summary: eval_makefile for $(MAKEFILES) doesn't add file name to strcache Project: make Submitted by: gnuser17 Submitted on: Tue 02 May 2017 03:43:47 AM UTC Severity: 3 - Normal Item Group: Bug Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: SCM Operating System: POSIX-Based Fixed Release: None Triage Status: None _______________________________________________________ Details: -- Problem: When make parses the files form the environment variable MAKEFILES it sets the associated ebuf.floc.filenm to the string passed in by the caller. When dealing with files from MAKEFILES, the memory location used to hold the name of said files is freed prior to executing their commands. Consequently, when make tries to report error caught during the execution of one of these files, it looks in ebuf.floc.filenm which points to memory that has been freed. -- Solution: cache the makefile's name before calling eval_makefile -- How to recreate the issue: # Assuming you have a file named 'makefile' in the directory you are running the commands from. # I have provided the file I used in the attachments. $- cp makefile m1 $- cp m1 m2 $- export MAKEFILES='makefile m1 m2' $- make -j4 all Please see: -- makefile: the makefile I used to generate the error and verify the fix -- run_*: files to compare the output the user sees pre and post fix -- valgrind_*: files to compare the running valgrind on make-4.2.1 pre and post fix Note: I've tested this for make-4.2.1 as well as HEAD. 'make check' passes all tests _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Tue 02 May 2017 03:43:47 AM UTC Name: logs.tar.gz Size: 2kB By: gnuser17 <http://savannah.gnu.org/bugs/download.php?file_id=40551> ------------------------------------------------------- Date: Tue 02 May 2017 03:43:47 AM UTC Name: makefile Size: 18B By: gnuser17 <http://savannah.gnu.org/bugs/download.php?file_id=40552> _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?50909> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make