bugmake - Bugs: bug #18995, variable origin changes upon...

 
 

bug #18995: variable origin changes upon export or unexport

Submitter:  Sam Yates <halfflat>
Submitted:  Thu 08 Feb 2007 12:57:33 PM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.81 Operating System:  Any
Fixed Release:  3.82 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 02 Jan 2023 07:53:19 PM UTC, comment #2: 

I didn't make the original request work.  I sort of think that by declaring a variable as "export" or "unexport", that does define the variable and I'm not sure that it's wrong that the origin becomes "file".

If someone wants to discuss this more (especially if you have a use-case for it) feel free to add more comments.

Note that the "undefine" facility was added in GNU make 3.82 and if you undefine a variable its origin does go back to "undefined".

Paul D. Smith <psmith>
Group administrator
Sat 10 Feb 2007 06:41:33 PM UTC, comment #1: 

Internally to make, an "undefined" origin means that the variable is not known to make (when make looks it up in its internal tables, nothing is found).

Obviously, once you export or unexport a variable, it has to be added to make's internal tables so make can remember that you marked it as exported or unexported... so then it's no longer undefined.

I can understand your point, however.  I've marked this as an enhancement request.  It shouldn't be too difficult to implement: a new origin value for undefined would need to be added, which is easy... but then all the places the origin is used would need to be examined to determine if or how they should react when a variable in this new state is found.

This would also allow us to create a way to "undefine" a variable; currently once a variable is defined it can never go back to the undefined state again.

Paul D. Smith <psmith>
Group administrator
Thu 08 Feb 2007 12:57:33 PM UTC, original submission:  

Exporting or unexporting a variable that is undefined, changes its origin to 'file'.

Expected behaviour is for export and (especially) unexport not to change the origin of an undefined variable, so that (for example) conditional assignments such as FOO?=foo behave as expected even after an export or unexport.

Example makefile:

$(info origin of FOO: $(origin FOO))
unexport FOO
$(info after 'unexport FOO': origin of FOO: $(origin FOO))

$(info origin of BAR: $(origin BAR))
export BAR
$(info after 'export BAR': origin of BAR: $(origin BAR))

.PHONY: dummy;
dummy: ;@:


Output:

origin of FOO: undefined
after 'unexport FOO': origin of FOO: file
origin of BAR: undefined
after 'export BAR': origin of BAR: file


Make version 3.81, x86_64-pc-linux-gnu.

Sam Yates <halfflat>

 

(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 halfflat (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
    2023-01-02 psmith StatusNone Fixed
        Open/ClosedOpen Closed
        Component VersionNone 3.81
        Fixed ReleaseNone 3.82
    2007-02-10 psmith Item GroupNone Enhancement
        Operating SystemNone Any

    Back to the top

    Powered by Savane 3.13-3cd0.
    Corresponding source code