diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-10-02 10:07:28 +0200 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-10-07 13:08:02 +0200 |
commit | 028568d84da3cfca49f5f846eeeef01441d70451 (patch) | |
tree | 6ffc6471517542ddb3d2470ccdc98fd93ac27fcc /Makefile | |
parent | Linux 4.14-rc3 (diff) | |
download | linux-028568d84da3cfca49f5f846eeeef01441d70451.tar.xz linux-028568d84da3cfca49f5f846eeeef01441d70451.zip |
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 'Makefile')
-rw-r--r-- | Makefile | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -130,8 +130,8 @@ endif ifneq ($(KBUILD_OUTPUT),) # check that the output directory actually exists saved-output := $(KBUILD_OUTPUT) -$(shell [ -d $(KBUILD_OUTPUT) ] || mkdir -p $(KBUILD_OUTPUT)) -KBUILD_OUTPUT := $(realpath $(KBUILD_OUTPUT)) +KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ + && /bin/pwd) $(if $(KBUILD_OUTPUT),, \ $(error failed to create output directory "$(saved-output)")) |