8199428: install-file macro fails on filenames with space on Solaris
authorerikj
Mon, 12 Mar 2018 17:49:08 +0100
changeset 49205 d1a19a08389a
parent 49204 564802b01ded
child 49206 e991d0be4cc9
8199428: install-file macro fails on filenames with space on Solaris Reviewed-by: tbell, ihse
make/common/MakeBase.gmk
--- a/make/common/MakeBase.gmk	Mon Mar 12 17:00:54 2018 +0100
+++ b/make/common/MakeBase.gmk	Mon Mar 12 17:49:08 2018 +0100
@@ -518,12 +518,14 @@
   define install-file
 	$(call MakeTargetDir)
 	$(RM) '$(call DecodeSpace, $@)'
-	if [ '$(call DecodeSpace, $(dir $@))' != \
+	if [ '$(call DecodeSpace, $(dir $(call EncodeSpace, $@)))' != \
 	    '$(call DecodeSpace, $(dir $(call EncodeSpace, $<)))' ]; then \
-	  $(CP) -f -r -P '$(call DecodeSpace, $<)' '$(call DecodeSpace, $(@D))'; \
-	  if [ '$(call DecodeSpace, $(@F))' != \
+	  $(CP) -f -r -P '$(call DecodeSpace, $<)' \
+	      '$(call DecodeSpace, $(dir $(call EncodeSpace, $@)))'; \
+	  if [ '$(call DecodeSpace, $(notdir $(call EncodeSpace, $@)))' != \
 	      '$(call DecodeSpace, $(notdir $(call EncodeSpace, $(<))))' ]; then \
-	    $(MV) '$(call DecodeSpace, $(@D)/$(<F))' '$(call DecodeSpace, $@)'; \
+	    $(MV) '$(call DecodeSpace, $(dir $(call EncodeSpace, $@))/$(notdir $(call EncodeSpace, $<)))' \
+	        '$(call DecodeSpace, $@)'; \
 	  fi; \
 	else \
 	  if [ -L '$(call DecodeSpace, $<)' ]; then \