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

 
 

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

Submitter:  enrique olaizola <gnuser17>
Submitted:  Tue 02 May 2017 03:43:47 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  4.3 Operating System:  POSIX-Based
Fixed Release:  4.3 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group administrator
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 (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 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

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 Files:
   
   
Comment:
   

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
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by atomsymbol
  • -email is unavailable- added by gnuser17 (Submitted the item)
  • -email is unavailable- added by gnuser17
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-06-04 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.3
    2017-05-02 atomsymbol Carbon-Copy- Added atomsymbol
    2017-05-02 gnuser17 Attached File- Added logs.tar.gz, #40551
        Attached File- Added makefile, #40552
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code