You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FileUtils.copyFile was changed to use the NIO Files.copy call a while back. Files.copy is invoked with the COPY_ATTRIBUTES and REPLACE_EXISTING attributes (which makes sense).
However, on Windows, COPY_ATTRIBUTES preserves the read-only flag if it's set on the source file, BUT REPLACE_EXISTING fails with an AccessDeniedException exception if the destinations' read-only attribute is set.
This is problematic because it breaks existing builds when updating from maven-war-plugin:3.1.0 to maven-war-plugin-3.2.0 (which switch from plexus-utils-3.0.24 to plexus-utils-3.1.0) where the SCM uses the read-only flag for unmodified files, e.g. Perforce.
TBH, I'm not sure where I come down on whether this is a bug in the JDK (REPLACE_EXISTING doesn't) or plexus-utils (using COPY_ATTRIBUTES may include attributes that make subsequent invocations with REPLACE_EXISTING to fail in a platform-specific way).
The text was updated successfully, but these errors were encountered:
awallgren
changed the title
FileUtils.copyFile fails on second invocation if Windows read-only flag is set on the source file
FileUtils.copyFile in 3.1.0 fails on second invocation if Windows read-only flag is set on the source file
Apr 8, 2018
awallgren
added a commit
to awallgren/plexus-utils
that referenced
this issue
Apr 8, 2018
FileUtils.copyFile was changed to use the NIO Files.copy call a while back. Files.copy is invoked with the COPY_ATTRIBUTES and REPLACE_EXISTING attributes (which makes sense).
However, on Windows, COPY_ATTRIBUTES preserves the read-only flag if it's set on the source file, BUT REPLACE_EXISTING fails with an AccessDeniedException exception if the destinations' read-only attribute is set.
This is problematic because it breaks existing builds when updating from maven-war-plugin:3.1.0 to maven-war-plugin-3.2.0 (which switch from plexus-utils-3.0.24 to plexus-utils-3.1.0) where the SCM uses the read-only flag for unmodified files, e.g. Perforce.
TBH, I'm not sure where I come down on whether this is a bug in the JDK (REPLACE_EXISTING doesn't) or plexus-utils (using COPY_ATTRIBUTES may include attributes that make subsequent invocations with REPLACE_EXISTING to fail in a platform-specific way).
The text was updated successfully, but these errors were encountered: