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 May 2 03:43:47 2017  
 
Severity: 3 - NormalItem Group: Bug
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Component Version: SCMOperating System: POSIX-Based
Fixed Release: NoneTriage Status: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Tue May 2 06:22:55 2017, 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 (name, RM_NO_DEFAULT_GOAL|RM_INCLUDED|RM_DONTCARE);
+ eval_makefile (strcache_add (name), RM_NO_DEFAULT_GOAL|RM_INCLUDED|RM_DONTCARE);
}

free (value);

enrique olaizola <gnuser17>
Tue May 2 03:43:47 2017, 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

Note:
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):
   
   
Comment:
   

Attached Files
file #40551:  logs.tar.gz added by gnuser17 (2kB - 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 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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue May 2 11:40:25 2017atomsymbolCarbon-Copy-=>Added atomsymbol
    Tue May 2 03:43:47 2017gnuser17Attached 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