[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #58420] PATH changes are not applied in $(shell) function

From: Martin Dorey
Subject: [bug #58420] PATH changes are not applied in $(shell) function
Date: Wed, 20 May 2020 22:30:00 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36

Follow-up Comment #2, bug #58420 (project make):

$(shell) commands in a recipe... well, we've all seen it done. 
 But, hang on, PATH doesn't behave specially for me:

martind@sirius:~/tmp/make-58420$ cat Makefile 
NOT_PATH := /nonexistent:$(NOT_PATH)
$(shell echo during parsing NOT_PATH=$(NOT_PATH) 1>&2)

default:; @echo "make variable NOT_PATH=$(NOT_PATH)"; echo "in target
commands, NOT_PATH=$$NOT_PATH"; echo "in \$$(shell commands), NOT_PATH=$(shell
echo "$$NOT_PATH")"
martind@sirius:~/tmp/make-58420$ NOT_PATH=export-me make
during parsing NOT_PATH=/nonexistent:export-me
make variable NOT_PATH=/nonexistent:export-me
in target commands, NOT_PATH=/nonexistent:export-me
in $(shell commands), NOT_PATH=export-me

(I put the recipe on one line because tabs often don't come out in the mail.)


Component Version:      4.3

I worried that it might be due to the new spawning code, but the results
above, which I think are consistent with the reporter's, were from make-4.1. 
I get the same from 4.0 and even 3.81.

After puzzling over the code, I belatedly realized that my "during parsing"
line above isn't doing the same as the $(shell) in the recipe.  The former is
passing the Make variable's value to $(shell), where the latter is getting it
out of the environment given to $(shell).  The code-comment here appears
likely to pertain:


... which points us at:


I think this is a duplicate.


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]