8189324: install-file macro no longer handles files with $ in them
authorerikj
Mon, 16 Oct 2017 12:56:23 +0200
changeset 47348 504e70cd64ad
parent 47347 26d9587d814b
child 47349 5958eaae167a
8189324: install-file macro no longer handles files with $ in them Reviewed-by: ihse
make/common/MakeBase.gmk
--- a/make/common/MakeBase.gmk	Mon Oct 16 14:30:37 2017 +0530
+++ b/make/common/MakeBase.gmk	Mon Oct 16 12:56:23 2017 +0200
@@ -500,20 +500,20 @@
   # so we fall back on regular copy, which isn't preserving symlinks.
   define install-file
 	$(call MakeDir, $(@D))
-	$(RM) "$(call DecodeSpace, $@)"
-	if [ "$(call DecodeSpace, $(dir $@))" != \
-	    "$(call DecodeSpace, $(dir $(call EncodeSpace, $<)))" ]; then \
-	  $(CP) -f -r -P "$(call DecodeSpace, $<)" "$(call DecodeSpace, $(@D))"; \
-	  if [ "$(call DecodeSpace, $(@F))" != \
-	      "$(call DecodeSpace, $(notdir $(call EncodeSpace, $(<))))" ]; then \
-	    $(MV) "$(call DecodeSpace, $(@D)/$(<F))" "$(call DecodeSpace, $@)"; \
+	$(RM) '$(call DecodeSpace, $@)'
+	if [ '$(call DecodeSpace, $(dir $@))' != \
+	    '$(call DecodeSpace, $(dir $(call EncodeSpace, $<)))' ]; then \
+	  $(CP) -f -r -P '$(call DecodeSpace, $<)' '$(call DecodeSpace, $(@D))'; \
+	  if [ '$(call DecodeSpace, $(@F))' != \
+	      '$(call DecodeSpace, $(notdir $(call EncodeSpace, $(<))))' ]; then \
+	    $(MV) '$(call DecodeSpace, $(@D)/$(<F))' '$(call DecodeSpace, $@)'; \
 	  fi; \
 	else \
-	  if [ -L "$(call DecodeSpace, $<)" ]; then \
+	  if [ -L '$(call DecodeSpace, $<)' ]; then \
 	    $(ECHO) "Source file is a symlink and target is in the same directory: $< $@" ; \
 	    exit 1; \
 	  fi; \
-	  $(CP) -f "$(call DecodeSpace, $<)" "$(call DecodeSpace, $@)"; \
+	  $(CP) -f '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'; \
 	fi
   endef
 else ifeq ($(OPENJDK_TARGET_OS),macosx)
@@ -527,21 +527,21 @@
   # weird errors.
   define install-file
 	$(call MakeDir, $(@D))
-	$(RM) "$(call DecodeSpace, $@)"
-	$(CP) -fRP "$(call DecodeSpace, $<)" "$(call DecodeSpace, $@)"
-	if [ -n "`$(XATTR) -l "$(call DecodeSpace, $@)"`" ]; then $(XATTR) -c "$(call DecodeSpace, $@)"; fi
+	$(RM) '$(call DecodeSpace, $@)'
+	$(CP) -fRP '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
+	if [ -n "`$(XATTR) -l '$(call DecodeSpace, $@)'`" ]; then $(XATTR) -c '$(call DecodeSpace, $@)'; fi
   endef
 else
   define install-file
 	$(call MakeDir, $(@D))
-	$(CP) -fP "$(call DecodeSpace, $<)" "$(call DecodeSpace, $@)"
+	$(CP) -fP '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
   endef
 endif
 
 # Variant of install file that does not preserve symlinks
 define install-file-nolink
 	$(call MakeDir, $(@D))
-	$(CP) -f "$(call DecodeSpace, $<)" "$(call DecodeSpace, $@)"
+	$(CP) -f '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
 endef
 
 ################################################################################
@@ -591,14 +591,14 @@
 # the unix emulation environment.
 define link-file-relative
 	$(call MakeDir, $(@D))
-	$(RM) "$(call DecodeSpace, $@)"
-	$(LN) -s "$(call DecodeSpace, $(call RelativePath, $<, $(@D)))" "$(call DecodeSpace, $@)"
+	$(RM) '$(call DecodeSpace, $@)'
+	$(LN) -s '$(call DecodeSpace, $(call RelativePath, $<, $(@D)))' '$(call DecodeSpace, $@)'
 endef
 
 define link-file-absolute
 	$(call MakeDir, $(@D))
-	$(RM) "$(call DecodeSpace, $@)"
-	$(LN) -s "$(call DecodeSpace, $<)" "$(call DecodeSpace, $@)"
+	$(RM) '$(call DecodeSpace, $@)'
+	$(LN) -s '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
 endef
 
 ################################################################################