bugmake - Bugs: bug #45275, 4.0+ core dumps with long .PHONY...

 
 

bug #45275: 4.0+ core dumps with long .PHONY targets via variables

Submitter:  David Boyce <boyski>
Submitted:  Mon 08 Jun 2015 01:45:44 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  4.1 Operating System:  POSIX-Based
Fixed Release:  4.2 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 13 Jul 2015 04:13:15 AM UTC, comment #2: 

I pushed a fix for this to Git.  Thanks for the report.

Paul D. Smith <psmith>
Group administrator
Mon 08 Jun 2015 01:46:41 PM UTC, comment #1: 

Sorry, ignore the "via variables" in the title string.

David Boyce <boyski>
Mon 08 Jun 2015 01:45:44 PM UTC, original submission:  

I've isolated a bug in which make 4.x segfaults when a phony target name is longer than 8162 characters. I'll attach the test case. I haven't tracked down the coding problem but I do have some useful data:

1. This is a regression: it does not occur in 3.82 but does in 4.0 and 4.1.

2. At least in my environment it occurs when the target is 8163 characters or longer. This number is not a factor of 2 though it's fairly close to 8192.

3. Interestingly, if the phony target is converted to a real target e.g.

<long string>: ; date

Then the result is "make: stat <long string>: File name too long

(with exit status of 0 which may be an ancillary bug). Technically a phony target shouldn't be subject to the same length limits as an actual target since nothing is imposed by the OS/filesystem. It may be acceptable to impose those limits anyway but the core dump shouldn't occur.

4. Running under gdb I was able to get a stack trace showing the eventual seg fault occurring in xcalloc(). The trace is below.

Program received signal SIGSEGV, Segmentation fault.
0x0000003a17a799b3 in _int_malloc () from /lib64/libc.so.6
(gdb) bt
#0  0x0000003a17a799b3 in _int_malloc () from /lib64/libc.so.6
#1  0x0000003a17a7a5a6 in calloc () from /lib64/libc.so.6
#2  0x000000000041ca6a in xcalloc (size=136) at misc.c:231
#3  0x000000000040aea5 in enter_file (name=0x65a4b1 'X' <repeats 2048 times>...) at file.c:185
#4  0x000000000040bdaf in enter_prereqs (deps=0x654e50, stem=0x0) at file.c:538
#5  0x0000000000422072 in record_files (filenames=0x663920, pattern=0x0, pattern_percent=0x0, depstr=0x6659c0 "h\365\330\027:",
    cmds_started=1, commands=0x663850 "\030\366\330\027:", commands_idx=0, two_colon=0, prefix=9 '\t', flocp=0x7fffffff6880)
    at read.c:2000
#6  0x000000000041fc22 in eval (ebuf=0x7fffffff6a60, set_default=1) at read.c:1013
#7  0x000000000041e958 in eval_makefile (filename=0x65a47d "Makefile", flags=0) at read.c:445
#8  0x000000000041e3b7 in read_all_makefiles (makefiles=0x0) at read.c:262
#9  0x0000000000419434 in main (argc=2, argv=0x7fffffffc688, envp=0x7fffffffc6a0) at main.c:1895
#10 0x0000003a17a1ecdd in __libc_start_main () from /lib64/libc.so.6
#11 0x0000000000405f49 in _start ()

David Boyce <boyski>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #34178:  Makefile.gz added by boyski (80B - application/x-gzip)

 

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 boyski (Submitted the item)
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-07-13 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.2
    2015-06-08 boyski Attached File- Added Makefile.gz, #34178

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code