bugmake - Bugs: bug #56446, Make shouldn't be running eval...

 
 

bug #56446: Make shouldn't be running eval when expanding variables for export

Submitter:  Mark Galeck <mark_galeck0>
Submitted:  Thu 06 Jun 2019 01:47:17 AM UTC
   
 
Severity:  3 - Normal Item Group:  Documentation
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  4.2.1 Operating System:  None
Fixed Release:  4.4 Triage Status:  Small Effort
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 22 Dec 2020 06:20:54 PM UTC, comment #2: 

I agree with Robert, this looks like a documentation issue. The behavior actually looks consistent to me.

A simple way to avoid exporting certain variables/functions automatically (besides unexport) is to prefix them with an invalid character for a shell variable:

define !FUNCTION
target: $1
endef

Aleksey Covacevice <alecov>
Thu 20 Aug 2020 07:31:28 AM UTC, comment #1: 

Yes, .EXPORT_ALL_VARIABLES should at least be documented for its danger regarding (forced) early expansion with the very first recipe being executed. This also breaks most usage of functions like error in variables.

As for this example, at least unexport FUNCTION2 helps here.

Robert Sachunsky <bertsky>
Thu 06 Jun 2019 01:47:17 AM UTC, original submission:  

This is a good Makefile (SSCCE example) that nevertheless bombs:


define FUNCTION
target: $1
endef

FUNCTION2 = $(eval $(call FUNCTION,$1))

.EXPORT_ALL_VARIABLES:

all:   
    echo OK


Now when you make this, you get:

Makefile:5: * prerequisites cannot be defined in recipes.  Stop.

Paul Smith suggested I file this request for enhancement:  Make shouldn't be running eval when expanding variables for export.

Mark Galeck <mark_galeck0>

 

(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 (Updated the item)
  • -email is unavailable- added by alecov (Posted a comment)
  • -email is unavailable- added by bertsky (Posted a comment)
  • -email is unavailable- added by mark_galeck0 (Submitted the item)
  •  

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

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-31 psmith Item GroupEnhancement Documentation
        StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.4
        Triage StatusNone Small Effort

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code