RFR: JDK-8036948: Solaris builds broken by fix for 8036611: Cleanup of handling of properties ...

Erik Joelsson erik.joelsson at oracle.com
Tue Mar 11 10:53:43 UTC 2014


Here is a new version of the patch after an offline comment from Magnus. 
This adds a failure message for the unhandled case of trying to copy a 
symlink within the same directory. Verified that the error is triggered 
by setting it up manually.

diff -r 65a66b8a998f make/common/MakeBase.gmk
--- a/make/common/MakeBase.gmk
+++ b/make/common/MakeBase.gmk
@@ -380,11 +380,22 @@
    # On Solaris, if the target is a symlink and exists, cp won't overwrite.
    # Cp has to operate in recursive mode to allow for -P flag, to 
preserve soft links. If the
    # name of the target file differs from the source file, rename after 
copy.
+  # If the source and target parent directories are the same, recursive 
copy doesn't work
+  # so we fall back on regular copy, which isn't preserving symlinks.
    define install-file
      $(MKDIR) -p $(@D)
      $(RM) '$@'
-    $(CP) -f -r -P '$<' '$(@D)'
-    if [ "$(@F)" != "$(<F)" ]; then $(MV) '$(@D)/$(<F)' '$@'; fi
+    if [ "$(@D)" != "$(<D)" ]; then \
+      $(CP) -f -r -P '$<' '$(@D)'; \
+      if [ "$(@F)" != "$(<F)" ]; then \
+        $(MV) '$(@D)/$(<F)' '$@'; \
+      fi; \
+    else \
+      if [ -L '$<' ]; then \
+        $(ECHO) "Source file is a symlink and target is in the same 
directory: $< $@" ; exit 1; \
+      fi; \
+      $(CP) -f '$<' '$@'; \
+    fi
    endef
  else ifeq ($(OPENJDK_TARGET_OS),macosx)
    # On mac, extended attributes sometimes creep into the source files, 
which may later


/Erik

On 2014-03-10 11:52, Erik Joelsson wrote:
> Hello,
>
> Please review this fix for the install-file macro on Solaris. It did 
> not work when copying a file into the same directory, which I started 
> doing with the properties files cleanup.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8036948
>
> Patch inline:
>
> diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk
> --- a/make/common/MakeBase.gmk
> +++ b/make/common/MakeBase.gmk
> @@ -380,11 +380,19 @@
>    # On Solaris, if the target is a symlink and exists, cp won't 
> overwrite.
>    # Cp has to operate in recursive mode to allow for -P flag, to 
> preserve soft links. If the
>    # name of the target file differs from the source file, rename 
> after copy.
> +  # If the source and target parent directories are the same, 
> recursive copy doesn't work
> +  # so we fall back on regular copy, which isn't preserving symlinks.
>    define install-file
>         $(MKDIR) -p $(@D)
>         $(RM) '$@'
> -       $(CP) -f -r -P '$<' '$(@D)'
> -       if [ "$(@F)" != "$(<F)" ]; then $(MV) '$(@D)/$(<F)' '$@'; fi
> +       if [ "$(@D)" != "$(<D)" ]; then \
> +         $(CP) -f -r -P '$<' '$(@D)'; \
> +         if [ "$(@F)" != "$(<F)" ]; then \
> +           $(MV) '$(@D)/$(<F)' '$@'; \
> +         fi \
> +       else \
> +         $(CP) -f '$<' '$@'; \
> +       fi
>    endef
>  else ifeq ($(OPENJDK_TARGET_OS),macosx)
>    # On mac, extended attributes sometimes creep into the source 
> files, which may later
>




More information about the build-dev mailing list