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

 
 

bug #47150: Silently fails on mistyped function names

Submitter:  Manoj Srivastava <srivasta>
Submitted:  Mon 15 Feb 2016 04:35:50 AM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.1 Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 27 Feb 2016 09:26:10 PM UTC, 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>
Group administrator
Mon 15 Feb 2016 04:35:50 AM UTC, original submission:  

Hi,
This was reported by a debian user. Please retain a CC to -email is 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 Files:
   
   
Comment:
   

No files currently attached

 

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

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

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-27 psmith Item GroupBug Enhancement
    2016-02-15 srivasta Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-269c.
    Corresponding source code