bugmake - Bugs: bug #50909, eval_makefile for $(MAKEFILES)...


bug #50909: eval_makefile for $(MAKEFILES) doesn't add file name to strcache

Submitted by:  enrique olaizola <gnuser17>
Submitted on:  Tue 02 May 2017 03:43:47 AM UTC  
Severity: 3 - NormalItem Group: Bug
Status: FixedPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: SCMOperating System: POSIX-Based
Fixed Release: SCMTriage Status: None

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sun 04 Jun 2017 10:54:41 PM UTC, comment #2:

A fix has been pushed and will be in the next release. Thank you for filing a report!

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Tue 02 May 2017 06:22:55 AM UTC, comment #1:

Patch didn't make it in the uploads so inserting it here:

diff --git a/read.c b/read.c
index 047807a..0718145 100644
--- a/read.c
+++ b/read.c
@@ -204,7 +204,7 @@ read_all_makefiles (const char **makefiles)
if (*p != '\0')
*p++ = '\0';
+ eval_makefile (strcache_add (name), RM_NO_DEFAULT_GOAL|RM_INCLUDED|RM_DONTCARE);

free (value);

enrique olaizola <gnuser17>
Tue 02 May 2017 03:43:47 AM UTC, original submission:

-- 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

I've tested this for make-4.2.1 as well as HEAD. 'make check' passes all tests

enrique olaizola <gnuser17>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #40551:  logs.tar.gz added by gnuser17 (2KiB - application/gzip)
file #40552:  makefile added by gnuser17 (18B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by atomsymbol
  • -unavailable- added by gnuser17 (Submitted the item)
  • -unavailable- added by gnuser17

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 04 Jun 2017 10:54:41 PM UTCpsmithStatusNone=>Fixed
      Assigned toNone=>psmith
      Fixed ReleaseNone=>SCM
    Tue 02 May 2017 11:40:25 AM UTCatomsymbolCarbon-Copy-=>Added atomsymbol
    Tue 02 May 2017 03:43:47 AM UTCgnuser17Attached File-=>Added logs.tar.gz, #40551
      Attached File-=>Added makefile, #40552
      Carbon-Copy-=>Added -unavailable-

    Back to the top

    Powered by Savane 3.1-cleanup1