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

 
 

bug #19626: Unexpected environment variable modification in command

Submitted by:  None
Submitted on:  Wed 18 Apr 2007 11:44:51 AM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.80Operating System: Any
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 18 Apr 2007 12:47:25 PM UTCpsmithStatusNone=>Not A Bug
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1