• Masahiro Yamada's avatar
    kbuild: revert $(realpath ...) to $(shell cd ... && /bin/pwd) · 028568d8
    Masahiro Yamada authored
    I thought commit 8e9b4667 ("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 8e9b4667.
    
    Fixes: 8e9b4667
    
     ("kbuild: use $(abspath ...) instead of $(shell cd ... && /bin/pwd)")
    Reported-by: default avatarJulien Grall <julien.grall@arm.com>
    Signed-off-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
    Tested-by: default avatarJulien Grall <julien.grall@arm.com>
    028568d8
Makefile.include 2.99 KB