Package: make
Version: 4.2.1-1
Severity: normal

Given the following Makefile:

--- BEGIN ---
PATH := /nonexistent:$(PATH)

default:
        @echo "make variable PATH=$(PATH)"
        @echo "in target commands, PATH=$$PATH"
        @echo "in \$$(shell commands), PATH=$(shell echo "$$PATH")"
--- END ---

'make' generates the output for me:

make variable 
PATH=/nonexistent:/home/ben/bin:/usr/lib/ccache:/usr/local/sbin:/usr/sbin:/sbin:/home/ben/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
in target commands, 
PATH=/nonexistent:/home/ben/bin:/usr/lib/ccache:/usr/local/sbin:/usr/sbin:/sbin:/home/ben/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
in $(shell commands), 
PATH=/home/ben/bin:/usr/lib/ccache:/usr/local/sbin:/usr/sbin:/sbin:/home/ben/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

I can't see any documentation that says the PATH variable is special,
so I think this is a bug.  I would guess that make defers evaluating
the PATH variable into the environment, in case it's recursively
expanded, but only re-evaulates it before running target commands.

Ben.

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.15.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages make depends on:
ii  libc6  2.27-2

make recommends no packages.

Versions of packages make suggests:
ii  make-doc  4.2.1-1

-- no debconf information

Reply via email to