bugmake - Bugs: bug #19626, Unexpected environment variable...

 
 

bug #19626: Unexpected environment variable modification in command

Submitter:  None
Submitted:  Wed 18 Apr 2007 11:44:51 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.80 Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 18 Apr 2007 12:47:25 PM UTC, comment #1: 

This is the way make is documented to work; from the GNU make manual, section "Variables from the Environment":

   When `make' runs a command script, variables defined in the makefile
are placed into the environment of that command.  This allows you to
pass values to sub-`make' invocations (*note Recursive Use of `make':
Recursion.).  By default, only variables that came from the environment
or the command line are passed to recursive invocations.  You can use
the `export' directive to pass other variables.  *Note Communicating
Variables to a Sub-`make': Variables/Recursion, for full details.


With the single exception of the SHELL variable, all environment variables are imported as make variables when make starts, and automatically marked as exported so that when make runs a command their current values will be exported into the environment of the command.

Paul D. Smith <psmith>
Group administrator
Wed 18 Apr 2007 11:44:51 AM UTC, original submission:  

When running following Makefile with GNU make 3.80 on Cygwin/Solaris/Linux it outputs value of the Make variable instead of environment variable in case an environment variable of the same name than Make variable exists.
[~]$ cat Makefile
IN_ENV = from_make
NOT_IN_ENV = from_make

all:
        echo $${IN_ENV}
        echo $${NOT_IN_ENV}

[~]$ make
echo ${IN_ENV}

echo ${NOT_IN_ENV}

=> that's OK
[~]$ export IN_ENV=from_env
[~]$ make
echo ${IN_ENV}
from_make
echo ${NOT_IN_ENV}

=> As variables are not exported I expect getting:
echo ${IN_ENV}
from_env
echo ${NOT_IN_ENV}


Anonymous

 

(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)
  •  

    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
    2007-04-18 psmith StatusNone Not A Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code