[jira] [Commented] (MRELEASE-1066) FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows

2022-01-02 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MRELEASE-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17467630#comment-17467630
 ] 

Michael Osipov commented on MRELEASE-1066:
--

Java makes it too easy to fail.

> FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows
> ---
>
> Key: MRELEASE-1066
> URL: https://issues.apache.org/jira/browse/MRELEASE-1066
> Project: Maven Release Plugin
>  Issue Type: Bug
>  Components: prepare
> Environment: Windows
>Reporter: Elliotte Rusty Harold
>Assignee: Slawomir Jaranowski
>Priority: Major
>  Labels: up-for-grabs
> Fix For: 3.0.0-M5
>
>
> This bug is shared (likely because of code copied from one place to another) 
> between the similar methods in commons IO, codehaus-plexus-utils, and 
> maven-shared-utils. 
> I don't have an isolated test case because this bug is platform specific and 
> I've only seen it in Travis CI builds on Windows using JDK 7 through 15. I 
> don't have a Windows system handy to test it. However it is reproducible. 
> Typical code that triggers it is in RestoreBackupPomsPhaseTest in 
> maven-release:
> ```
> // copy poms so tests are valid without clean
> File sourceDir = getTestFile( "src/test/resources" + projectPath );
> File testDir = getTestFile( "target/test-classes" + projectPath );
> FileUtils.copyDirectoryStructure( sourceDir, testDir );
> ```
> I don't know whether there might be something weird in the setup of those two 
> directories that's involved. 
> Typical error message is:
> Caused by: java.nio.file.FileSystemException:
> F:\jenkins\jenkins-slave\workspace\maven-box_maven-release_windows@2@2\windows-jdk8-m3.6.x_build\maven-release-manager\target\test-classes\projects\restore-backup-poms\basic-pom\pom.xml:
>  The process cannot access the file because it is being used by another 
> process
> "The process cannot access the file because it is being used by another 
> process" I think points to the root of the bug. This is a Windows file system 
> error message.
> Some history is here where I noticed it:
> https://github.com/apache/maven-release/pull/42
> In this case, I started with plexus-utils 3.1.0 which worked, upgraded t 
> plexus-utils 3.3.0, which didn't. And then tried the FileUtils.copyDirectory 
> from both maven-shared-utils and commons-io, all of which failed in the same 
> way. 
> I think this is caused by the use of NIO, which doesn't work quite the same 
> when copying files on Windows as on Linux and Mac OS X.
> Also see https://issues.apache.org/jira/browse/IO-663?filter=-2



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (MRELEASE-1066) FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows

2022-01-02 Thread Gary D. Gregory (Jira)


[ 
https://issues.apache.org/jira/browse/MRELEASE-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17467628#comment-17467628
 ] 

Gary D. Gregory commented on MRELEASE-1066:
---

>From a Java POV, the commit looks like a plain old bug fix. You can't just 
>leak file handles. An other negative side effect of leaving some IO instances 
>open, is that it puts more pressure on GC because some IO classes implement 
>finalization, and relying on that is an anti-pattern. Using the NIO Files 
>class to open files returns instances that do not implement finalization. 

> FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows
> ---
>
> Key: MRELEASE-1066
> URL: https://issues.apache.org/jira/browse/MRELEASE-1066
> Project: Maven Release Plugin
>  Issue Type: Bug
>  Components: prepare
> Environment: Windows
>Reporter: Elliotte Rusty Harold
>Assignee: Slawomir Jaranowski
>Priority: Major
>  Labels: up-for-grabs
> Fix For: 3.0.0-M5
>
>
> This bug is shared (likely because of code copied from one place to another) 
> between the similar methods in commons IO, codehaus-plexus-utils, and 
> maven-shared-utils. 
> I don't have an isolated test case because this bug is platform specific and 
> I've only seen it in Travis CI builds on Windows using JDK 7 through 15. I 
> don't have a Windows system handy to test it. However it is reproducible. 
> Typical code that triggers it is in RestoreBackupPomsPhaseTest in 
> maven-release:
> ```
> // copy poms so tests are valid without clean
> File sourceDir = getTestFile( "src/test/resources" + projectPath );
> File testDir = getTestFile( "target/test-classes" + projectPath );
> FileUtils.copyDirectoryStructure( sourceDir, testDir );
> ```
> I don't know whether there might be something weird in the setup of those two 
> directories that's involved. 
> Typical error message is:
> Caused by: java.nio.file.FileSystemException:
> F:\jenkins\jenkins-slave\workspace\maven-box_maven-release_windows@2@2\windows-jdk8-m3.6.x_build\maven-release-manager\target\test-classes\projects\restore-backup-poms\basic-pom\pom.xml:
>  The process cannot access the file because it is being used by another 
> process
> "The process cannot access the file because it is being used by another 
> process" I think points to the root of the bug. This is a Windows file system 
> error message.
> Some history is here where I noticed it:
> https://github.com/apache/maven-release/pull/42
> In this case, I started with plexus-utils 3.1.0 which worked, upgraded t 
> plexus-utils 3.3.0, which didn't. And then tried the FileUtils.copyDirectory 
> from both maven-shared-utils and commons-io, all of which failed in the same 
> way. 
> I think this is caused by the use of NIO, which doesn't work quite the same 
> when copying files on Windows as on Linux and Mac OS X.
> Also see https://issues.apache.org/jira/browse/IO-663?filter=-2



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (MRELEASE-1066) FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows

2022-01-01 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MRELEASE-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17467521#comment-17467521
 ] 

Michael Osipov commented on MRELEASE-1066:
--

You are describing a typical Windows problem of exclusive file locking when 
open. POSIX does not suffer from this. Let's see how far we get. If we have 
leaks, we must fix them, but we cannot and will not fix Windows.

> FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows
> ---
>
> Key: MRELEASE-1066
> URL: https://issues.apache.org/jira/browse/MRELEASE-1066
> Project: Maven Release Plugin
>  Issue Type: Bug
>  Components: prepare
> Environment: Windows
>Reporter: Elliotte Rusty Harold
>Assignee: Slawomir Jaranowski
>Priority: Major
>  Labels: up-for-grabs
> Fix For: 3.0.0
>
>
> This bug is shared (likely because of code copied from one place to another) 
> between the similar methods in commons IO, codehaus-plexus-utils, and 
> maven-shared-utils. 
> I don't have an isolated test case because this bug is platform specific and 
> I've only seen it in Travis CI builds on Windows using JDK 7 through 15. I 
> don't have a Windows system handy to test it. However it is reproducible. 
> Typical code that triggers it is in RestoreBackupPomsPhaseTest in 
> maven-release:
> ```
> // copy poms so tests are valid without clean
> File sourceDir = getTestFile( "src/test/resources" + projectPath );
> File testDir = getTestFile( "target/test-classes" + projectPath );
> FileUtils.copyDirectoryStructure( sourceDir, testDir );
> ```
> I don't know whether there might be something weird in the setup of those two 
> directories that's involved. 
> Typical error message is:
> Caused by: java.nio.file.FileSystemException:
> F:\jenkins\jenkins-slave\workspace\maven-box_maven-release_windows@2@2\windows-jdk8-m3.6.x_build\maven-release-manager\target\test-classes\projects\restore-backup-poms\basic-pom\pom.xml:
>  The process cannot access the file because it is being used by another 
> process
> "The process cannot access the file because it is being used by another 
> process" I think points to the root of the bug. This is a Windows file system 
> error message.
> Some history is here where I noticed it:
> https://github.com/apache/maven-release/pull/42
> In this case, I started with plexus-utils 3.1.0 which worked, upgraded t 
> plexus-utils 3.3.0, which didn't. And then tried the FileUtils.copyDirectory 
> from both maven-shared-utils and commons-io, all of which failed in the same 
> way. 
> I think this is caused by the use of NIO, which doesn't work quite the same 
> when copying files on Windows as on Linux and Mac OS X.
> Also see https://issues.apache.org/jira/browse/IO-663?filter=-2



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (MRELEASE-1066) FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows

2022-01-01 Thread elharo (Jira)


[ 
https://issues.apache.org/jira/browse/MRELEASE-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17467513#comment-17467513
 ] 

elharo commented on MRELEASE-1066:
--

That commit might be a workaround, but I don't think it gets at the root of the 
bug though it does suggest what the problem might be. Based on that commit it 
look as if the problem is that NIO on windows can't copy open files whereas NIO 
on other platforms and non-NIO solutions can. Ideally this should be fixed so 
that `FileUtils.copyDirectory` works when files are open, or, at the absolute 
least, it fails with amore descriptive error message. 

> FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows
> ---
>
> Key: MRELEASE-1066
> URL: https://issues.apache.org/jira/browse/MRELEASE-1066
> Project: Maven Release Plugin
>  Issue Type: Bug
>  Components: prepare
> Environment: Windows
>Reporter: Elliotte Rusty Harold
>Assignee: Slawomir Jaranowski
>Priority: Major
>  Labels: up-for-grabs
> Fix For: 3.0.0
>
>
> This bug is shared (likely because of code copied from one place to another) 
> between the similar methods in commons IO, codehaus-plexus-utils, and 
> maven-shared-utils. 
> I don't have an isolated test case because this bug is platform specific and 
> I've only seen it in Travis CI builds on Windows using JDK 7 through 15. I 
> don't have a Windows system handy to test it. However it is reproducible. 
> Typical code that triggers it is in RestoreBackupPomsPhaseTest in 
> maven-release:
> ```
> // copy poms so tests are valid without clean
> File sourceDir = getTestFile( "src/test/resources" + projectPath );
> File testDir = getTestFile( "target/test-classes" + projectPath );
> FileUtils.copyDirectoryStructure( sourceDir, testDir );
> ```
> I don't know whether there might be something weird in the setup of those two 
> directories that's involved. 
> Typical error message is:
> Caused by: java.nio.file.FileSystemException:
> F:\jenkins\jenkins-slave\workspace\maven-box_maven-release_windows@2@2\windows-jdk8-m3.6.x_build\maven-release-manager\target\test-classes\projects\restore-backup-poms\basic-pom\pom.xml:
>  The process cannot access the file because it is being used by another 
> process
> "The process cannot access the file because it is being used by another 
> process" I think points to the root of the bug. This is a Windows file system 
> error message.
> Some history is here where I noticed it:
> https://github.com/apache/maven-release/pull/42
> In this case, I started with plexus-utils 3.1.0 which worked, upgraded t 
> plexus-utils 3.3.0, which didn't. And then tried the FileUtils.copyDirectory 
> from both maven-shared-utils and commons-io, all of which failed in the same 
> way. 
> I think this is caused by the use of NIO, which doesn't work quite the same 
> when copying files on Windows as on Linux and Mac OS X.
> Also see https://issues.apache.org/jira/browse/IO-663?filter=-2



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (MRELEASE-1066) FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows

2022-01-01 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MRELEASE-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17467453#comment-17467453
 ] 

Michael Osipov commented on MRELEASE-1066:
--

Fixed with 
[f94b60e4abf5d40ed9422d9961fc789ded5f4ad9|https://gitbox.apache.org/repos/asf?p=maven-release.git;a=commit;h=f94b60e4abf5d40ed9422d9961fc789ded5f4ad9].

> FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows
> ---
>
> Key: MRELEASE-1066
> URL: https://issues.apache.org/jira/browse/MRELEASE-1066
> Project: Maven Release Plugin
>  Issue Type: Bug
>  Components: prepare
> Environment: Windows
>Reporter: Elliotte Rusty Harold
>Assignee: Slawomir Jaranowski
>Priority: Major
>  Labels: up-for-grabs
>
> This bug is shared (likely because of code copied from one place to another) 
> between the similar methods in commons IO, codehaus-plexus-utils, and 
> maven-shared-utils. 
> I don't have an isolated test case because this bug is platform specific and 
> I've only seen it in Travis CI builds on Windows using JDK 7 through 15. I 
> don't have a Windows system handy to test it. However it is reproducible. 
> Typical code that triggers it is in RestoreBackupPomsPhaseTest in 
> maven-release:
> ```
> // copy poms so tests are valid without clean
> File sourceDir = getTestFile( "src/test/resources" + projectPath );
> File testDir = getTestFile( "target/test-classes" + projectPath );
> FileUtils.copyDirectoryStructure( sourceDir, testDir );
> ```
> I don't know whether there might be something weird in the setup of those two 
> directories that's involved. 
> Typical error message is:
> Caused by: java.nio.file.FileSystemException:
> F:\jenkins\jenkins-slave\workspace\maven-box_maven-release_windows@2@2\windows-jdk8-m3.6.x_build\maven-release-manager\target\test-classes\projects\restore-backup-poms\basic-pom\pom.xml:
>  The process cannot access the file because it is being used by another 
> process
> "The process cannot access the file because it is being used by another 
> process" I think points to the root of the bug. This is a Windows file system 
> error message.
> Some history is here where I noticed it:
> https://github.com/apache/maven-release/pull/42
> In this case, I started with plexus-utils 3.1.0 which worked, upgraded t 
> plexus-utils 3.3.0, which didn't. And then tried the FileUtils.copyDirectory 
> from both maven-shared-utils and commons-io, all of which failed in the same 
> way. 
> I think this is caused by the use of NIO, which doesn't work quite the same 
> when copying files on Windows as on Linux and Mac OS X.
> Also see https://issues.apache.org/jira/browse/IO-663?filter=-2



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (MRELEASE-1066) FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows

2021-06-07 Thread Elliotte Rusty Harold (Jira)


[ 
https://issues.apache.org/jira/browse/MRELEASE-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17358549#comment-17358549
 ] 

Elliotte Rusty Harold commented on MRELEASE-1066:
-

Interesting. You're thinking there's a bug in the test that is exposed by the 
upgrade to plexus-utils 3.3.0?

> FileUtils.copyDirectory(File srcDir, File destDir) fails on Windows
> ---
>
> Key: MRELEASE-1066
> URL: https://issues.apache.org/jira/browse/MRELEASE-1066
> Project: Maven Release Plugin
>  Issue Type: Bug
>  Components: prepare
> Environment: Windows
>Reporter: Elliotte Rusty Harold
>Priority: Major
>  Labels: up-for-grabs
>
> This bug is shared (likely because of code copied from one place to another) 
> between the similar methods in commons IO, codehaus-plexus-utils, and 
> maven-shared-utils. 
> I don't have an isolated test case because this bug is platform specific and 
> I've only seen it in Travis CI builds on Windows using JDK 7 through 15. I 
> don't have a Windows system handy to test it. However it is reproducible. 
> Typical code that triggers it is in RestoreBackupPomsPhaseTest in 
> maven-release:
> ```
> // copy poms so tests are valid without clean
> File sourceDir = getTestFile( "src/test/resources" + projectPath );
> File testDir = getTestFile( "target/test-classes" + projectPath );
> FileUtils.copyDirectoryStructure( sourceDir, testDir );
> ```
> I don't know whether there might be something weird in the setup of those two 
> directories that's involved. 
> Typical error message is:
> Caused by: java.nio.file.FileSystemException:
> F:\jenkins\jenkins-slave\workspace\maven-box_maven-release_windows@2@2\windows-jdk8-m3.6.x_build\maven-release-manager\target\test-classes\projects\restore-backup-poms\basic-pom\pom.xml:
>  The process cannot access the file because it is being used by another 
> process
> "The process cannot access the file because it is being used by another 
> process" I think points to the root of the bug. This is a Windows file system 
> error message.
> Some history is here where I noticed it:
> https://github.com/apache/maven-release/pull/42
> In this case, I started with plexus-utils 3.1.0 which worked, upgraded t 
> plexus-utils 3.3.0, which didn't. And then tried the FileUtils.copyDirectory 
> from both maven-shared-utils and commons-io, all of which failed in the same 
> way. 
> I think this is caused by the use of NIO, which doesn't work quite the same 
> when copying files on Windows as on Linux and Mac OS X.
> Also see https://issues.apache.org/jira/browse/IO-663?filter=-2



--
This message was sent by Atlassian Jira
(v8.3.4#803005)