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 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.82Operating System: POSIX-Based
Fixed Release: NoneTriage 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 File(s):
   
   
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
  • -unavailable- added by psmith (Posted a comment)
  •  

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

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 19 May 2011 01:38:32 AM UTCpsmithStatusNone=>Not A Bug
      Open/ClosedOpen=>Closed
    Thu 19 May 2011 01:27:22 AM UTCNoneAttached File-=>Added stooges.mk, #23424

    Back to the top


    Powered by Savane 3.1-cleanup1