diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-10-02 04:07:28 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-10-07 07:08:02 -0400 |
commit | 028568d84da3cfca49f5f846eeeef01441d70451 (patch) | |
tree | 6ffc6471517542ddb3d2470ccdc98fd93ac27fcc /tools | |
parent | 9e66317d3c92ddaab330c125dfe9d06eee268aff (diff) |
kbuild: revert $(realpath ...) to $(shell cd ... && /bin/pwd)
I thought commit 8e9b46679923 ("kbuild: use $(abspath ...) instead of
$(shell cd ... && /bin/pwd)") was a safe conversion, but it changed
the behavior.
$(abspath ...) / $(realpath ...) does not expand shell special
characters, such as '~'.
Here is a simple Makefile example:
---------------->8----------------
$(info /bin/pwd: $(shell cd ~/; /bin/pwd))
$(info abspath: $(abspath ~/))
$(info realpath: $(realpath ~/))
all:
@:
---------------->8----------------
$ make
/bin/pwd: /home/masahiro
abspath: /home/masahiro/workspace/~
realpath:
This can be a real problem if 'make O=~/foo' is invoked from another
Makefile or primitive shell like dash.
This commit partially reverts 8e9b46679923.
Fixes: 8e9b46679923 ("kbuild: use $(abspath ...) instead of $(shell cd ... && /bin/pwd)")
Reported-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Julien Grall <julien.grall@arm.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/cpupower/Makefile | 2 | ||||
-rw-r--r-- | tools/scripts/Makefile.include | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile index 4c5a481a850c..d6e1c02ddcfe 100644 --- a/tools/power/cpupower/Makefile +++ b/tools/power/cpupower/Makefile | |||
@@ -26,7 +26,7 @@ endif | |||
26 | 26 | ||
27 | ifneq ($(OUTPUT),) | 27 | ifneq ($(OUTPUT),) |
28 | # check that the output directory actually exists | 28 | # check that the output directory actually exists |
29 | OUTDIR := $(realpath $(OUTPUT)) | 29 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) |
30 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) | 30 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) |
31 | endif | 31 | endif |
32 | 32 | ||
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include index 9dc8f078a83c..1e8b6116ba3c 100644 --- a/tools/scripts/Makefile.include +++ b/tools/scripts/Makefile.include | |||
@@ -1,7 +1,7 @@ | |||
1 | ifneq ($(O),) | 1 | ifneq ($(O),) |
2 | ifeq ($(origin O), command line) | 2 | ifeq ($(origin O), command line) |
3 | ABSOLUTE_O := $(realpath $(O)) | 3 | dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),) |
4 | dummy := $(if $(ABSOLUTE_O),,$(error O=$(O) does not exist)) | 4 | ABSOLUTE_O := $(shell cd $(O) ; pwd) |
5 | OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) | 5 | OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) |
6 | COMMAND_O := O=$(ABSOLUTE_O) | 6 | COMMAND_O := O=$(ABSOLUTE_O) |
7 | ifeq ($(objtree),) | 7 | ifeq ($(objtree),) |
@@ -12,7 +12,7 @@ endif | |||
12 | 12 | ||
13 | # check that the output directory actually exists | 13 | # check that the output directory actually exists |
14 | ifneq ($(OUTPUT),) | 14 | ifneq ($(OUTPUT),) |
15 | OUTDIR := $(realpath $(OUTPUT)) | 15 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) |
16 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) | 16 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) |
17 | endif | 17 | endif |
18 | 18 | ||