bugmake - Bugs: bug #33344, Undefined variables introduce...

 
 

bug #33344: Undefined variables introduce leading whitespace during variable assignment

Submitted by:  None
Submitted on:  Thu 19 May 2011 01:27:22 AM UTC  
 
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.82 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

Thu 19 May 2011 01:38:32 AM UTC, comment #1: 

Regarding the leading whitespace: all versions of make behave this way and the POSIX standard requires it.  The manual is exactly correct: leading whitespace immediately after the "=" is ignored... but that's handled at parse time BEFORE any expansion of variables is done.

Regarding the issue with make 3.82 failing, I believe that's an instance of bug #30612

Paul D. Smith <psmith>
Project Administrator
Thu 19 May 2011 01:27:22 AM UTC, original submission:  

A null variable as the first item of a variable definition introduces leading white space, which breaks an archive target and seems at variance to the GNU Make Manual, Section 6.5, Setting Variables: "Whitespace ... immediately after the ‘=’ is ignored."

A commonly used idiom illustrates the problem:

# Enumerate source files:
CCSRC.c =
CCCSRC.cc = larry.cc curly.cc moe.cc

# Compute the object files:
OBJECTS_FAIL = $(CCSRC.c:.c=.o) $(CCCSRC.cc:.cc=.o)
OBJECTS_SUCCESS = $(CCCSRC.cc:.cc=.o) $(CCSRC.c:.c=.o)

OBJECTS_FAIL will have a leading space, whereas _SUCCESS will not. This space causes archive pre-requisites to fail (new for 3.82):

fail: printF libfail.a($(OBJECTS_FAIL))

----------------
A test case demonstrating the discrepancy is attached.
This problem was found using:
GNU Make 3.82 on Linux 2.6.37.6 x86_64 GNU/Linux

Running the same case under Make 3.81 shows the same leading space, but archive pre-requisites will succeed.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #23424:  stooges.mk added by None (2KiB - text/x-makefile)

 

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

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

    Only logged-in users can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-05-19 psmith StatusNone => Not A Bug
        Open/ClosedOpen => Closed
    2011-05-19 None Attached File- => Added stooges.mk, #23424

    Back to the top


    Powered by Savane 3.5