summaryrefslogtreecommitdiffstats
path: root/tools/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-10-02 17:07:28 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-10-07 20:08:02 +0900
commit028568d84da3cfca49f5f846eeeef01441d70451 (patch)
tree6ffc6471517542ddb3d2470ccdc98fd93ac27fcc /tools/scripts
parent9e66317d3c92ddaab330c125dfe9d06eee268aff (diff)
downloadlinux-stable-028568d84da3cfca49f5f846eeeef01441d70451.tar.gz
linux-stable-028568d84da3cfca49f5f846eeeef01441d70451.tar.bz2
linux-stable-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 'tools/scripts')
-rw-r--r--tools/scripts/Makefile.include6
1 files changed, 3 insertions, 3 deletions
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 @@
ifneq ($(O),)
ifeq ($(origin O), command line)
- ABSOLUTE_O := $(realpath $(O))
- dummy := $(if $(ABSOLUTE_O),,$(error O=$(O) does not exist))
+ dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),)
+ ABSOLUTE_O := $(shell cd $(O) ; pwd)
OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
COMMAND_O := O=$(ABSOLUTE_O)
ifeq ($(objtree),)
@@ -12,7 +12,7 @@ endif
# check that the output directory actually exists
ifneq ($(OUTPUT),)
-OUTDIR := $(realpath $(OUTPUT))
+OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
endif