bugmake - Bugs: bug #17448, Function argument parsing...

 
 

bug #17448: Function argument parsing inconsistent in treatment of whitespace

Submitter:  Robert Bogomip <bobbogo>
Submitted:  Wed 16 Aug 2006 04:49:18 PM UTC
   
 
Severity:  3 - Normal Priority:  5 - Normal
Item Group:  Bug Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Component Version:  3.80
Operating System:  Any Fixed Release:  None
Triage Status:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Sun 08 Jan 2023 11:58:01 PM UTC, comment #2: 

I pushed a fix for the $(file ...) function.

The other inconsistencies will need to be dealt with later... I don't want to make backward-incompatible changes right now.

Paul D. Smith <psmith>
Group administrator
Mon 04 Oct 2021 01:55:38 PM UTC, comment #1: 

I found a very annoying problem which seems related to this issue (and only apply to v >= 4.2 which includes function `file`):

This one will read `filename`:
$(file <filename)

This one will read `filename ` (with space behind):
$(file <filename\ )

This one will fail silently:
$(file <filename )


Anonymous
Wed 16 Aug 2006 04:49:18 PM UTC, original submission:  

What does this makefile produce?

$ cat Makefile
e :=
s := $e hello   there $e
$(warning if: [$(if $e , some , <none> )])
$(warning and: [$(and a$e , $s )])
$(warning or: [$(or $e ,$s)])
$(warning patsubst:[$(patsubst aa,a,$s)])
$(warning patsubst:[$(patsubst aa%,a, $s )])
$(warning patsubst:[$(patsubst aa%%,a, $s )])
$(warning patsubst:[$(patsubst hello,,$s)])
$(warning patsubst:[$(patsubst hello ,,$s)])
args = $(warning args: [$1][$2][$3])
$(call   args ,$s, $s, $s )
$(error bye)

$ make380 2>&1 | tr ' ' ,
Makefile:3:,if:,[,some,]
Makefile:4:,and:,[]
Makefile:5:,or:,[]
Makefile:6:,patsubst:[,hello,,,there,]
Makefile:7:,patsubst:[hello,there]
Makefile:8:,patsubst:[hello,there]
Makefile:9:,patsubst:[,,,,there,]
Makefile:10:,patsubst:[,,,there,]
Makefile:12:,args:,[,hello,,,there,][,,hello,,,there,][,,hello,,,there,,]
Makefile:13:,***,bye.,,Stop.

$ make381 2>&1 | tr ' ' ,
Makefile:3:,if:,[,<none>,]
Makefile:4:,and:,[,hello,,,there,]
Makefile:5:,or:,[,hello,,,there,]
Makefile:6:,patsubst:[,hello,,,there,]
Makefile:7:,patsubst:[hello,there]
Makefile:8:,patsubst:[hello,there]
Makefile:9:,patsubst:[,,,,there,]
Makefile:10:,patsubst:[,,,there,]
Makefile:12:,args:,[,hello,,,there,][,,hello,,,there,][,,hello,,,there,,]
Makefile:13:,***,bye.,,Stop.

Dunno how to rationalise this. Some functions strip w.s. from around all the arguments (and, or); some from just the first argument (call); and patsubst will $(strip) its last argument only when its first contains a % (even if it's doubled as in %%).

Oh, and there's a regression in the 1st argument of $(if) from 3.80 to 3.81.

This is a documentation error if nothing else. The manual says "The arguments are the arguments of the function. They are separated from the function name by one or more spaces or tabs, and if there is more than one argument, then they are separated by commas. Such whitespace and commas are not part of an argument's value." Does the "such whitespace" in this snippet mean just the w.s. between the function name and the first argument? It seems that only $(patsubst) does it right in this regard.

Robert Bogomip <bobbogo>

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  •  

    Votes

    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.

     

    History

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.16-1b88.
    Corresponding source code