bugmake - Bugs: bug #47150, Silently fails on mistyped...

 
 

bug #47150: Silently fails on mistyped function names

Submitted by:  Manoj Srivastava <srivasta>
Submitted on:  Mon Feb 15 04:35:50 2016  
 
Severity: 3 - NormalItem Group: Enhancement
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Component Version: 4.1Operating System: Any
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.

 

Sat Feb 27 21:26:10 2016, comment #1:

Historically, GNU make has not disallowed whitespace to appear in variable names. So, when you write "$(dirname FOO)" make cannot tell the difference between a mis-typed function name and an honest attempt to expand a variable named literally "dirname FOO".

As you no doubt are aware, there's no warning or error provided when you attempt to expand a variable which doesn't exist.

This is why you don't get any notification when you mistype a function name. You can of course enable the "--warn-undefined-variables" flag and this will cause GNU make to complain about any attempt to expand any undefined variable, including things you intended to be functions but were not.

Over the last few releases I've been deprecating the ability to create variable names containing whitespace. Once that is fully in effect, GNU make can treat a reference containing whitespace to be an attempt to use an undefined function and generate a proper warning for it.

I'm resetting this to be an enhancement request.

Paul D. Smith <psmith>
Project Administrator
Mon Feb 15 04:35:50 2016, original submission:

Hi,
This was reported by a debian user. Please retain a CC to -unavailable- so that the Debian BTS has a copy of your input.

make ignores it when an undefined function is used in a makefile, and just substitutes the empty string for the function call. Instead, it really, really should fail and report a faulty makefile. Especially because there are no user-defined functions so this unfriendly behavior doesn't even buy anything in flexibility.

I have just spent an hour or so debugging a 20 line makefile. I used the dirname function in one of my rules, only I forgot that for make it is spelled just $(dir ...) and not ($dirname ...) . I was at the point of throwing something at my computer, and I'm exaggerating only a tiny little bit.

Exemplar
########################################
all:
@echo $(dirname $(shell pwd))
########################################
Selently returns nothing.

Manoj

Manoj Srivastava <srivasta>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

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)
  • -unavailable- added by srivasta (Submitted the item)
  • -unavailable- added by srivasta (Debian BTS)
  •  

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

    Date Changed By Updated Field Previous Value => Replaced By
    Sat Feb 27 21:26:10 2016psmithItem GroupBug=>Enhancement
    Mon Feb 15 04:35:50 2016srivastaCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1