You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mark Bryan Yu (JIRA)" <ji...@apache.org> on 2007/11/30 23:10:43 UTC
[jira] Created: (IO-141) [IO][PATCH] Infinite loop on
FileUtils.copyDirectory when the destination directory is within the source
directory
[IO][PATCH] Infinite loop on FileUtils.copyDirectory when the destination directory is within the source directory
------------------------------------------------------------------------------------------------------------------
Key: IO-141
URL: https://issues.apache.org/jira/browse/IO-141
Project: Commons IO
Issue Type: Bug
Components: Utilities
Affects Versions: 1.3.2
Environment: Win XP
Reporter: Mark Bryan Yu
Priority: Critical
When you attempt to copy a directory and the destination directory is inside the source directory an inifinite loop occurs in the copyDirectory causing Commons-IO to create a folder w/o stopping until its reaches OS limitation.
This code will recreate the bug:
FileUtils.copyDirectory(new File("C:\\temp\\test-io\\a\\."), new File("C:\\temp\\test-io\\a\\." + File.separator + new Date().getTime()));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (IO-141) Infinite loop on FileUtils.copyDirectory
when the destination directory is within the source directory
Posted by "Shaun Geisert (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859490#action_12859490 ]
Shaun Geisert commented on IO-141:
----------------------------------
For anyone who may have fallen victim to the above bug, and is using Windows, and now wants to be able to delete all those nested folders, you may want to take a look at
http://www.jowie.com/blog/post/2008/10/27/HOW-TO-Remove-files-that-have-a-path-that-is-too-long-for-Windows-to-delete.aspx
in order to delete the folders using robocopy.
> Infinite loop on FileUtils.copyDirectory when the destination directory is within the source directory
> ------------------------------------------------------------------------------------------------------
>
> Key: IO-141
> URL: https://issues.apache.org/jira/browse/IO-141
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2
> Environment: Win XP
> Reporter: Mark Bryan Yu
> Assignee: Niall Pemberton
> Priority: Critical
> Fix For: 1.4
>
> Attachments: fix_recursion_bug.patch
>
>
> When you attempt to copy a directory and the destination directory is inside the source directory an inifinite loop occurs in the copyDirectory causing Commons-IO to create a folder w/o stopping until its reaches OS limitation.
> This code will recreate the bug:
> FileUtils.copyDirectory(new File("C:\\temp\\test-io\\a\\."), new File("C:\\temp\\test-io\\a\\." + File.separator + new Date().getTime()));
> Make sure C:\temp\test-io\a exists
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (IO-141) Infinite loop on FileUtils.copyDirectory
when the destination directory is within the source directory
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Niall Pemberton updated IO-141:
-------------------------------
Fix Version/s: 1.4
Assignee: Niall Pemberton
Summary: Infinite loop on FileUtils.copyDirectory when the destination directory is within the source directory (was: [IO][PATCH] Infinite loop on FileUtils.copyDirectory when the destination directory is within the source directory)
> Infinite loop on FileUtils.copyDirectory when the destination directory is within the source directory
> ------------------------------------------------------------------------------------------------------
>
> Key: IO-141
> URL: https://issues.apache.org/jira/browse/IO-141
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2
> Environment: Win XP
> Reporter: Mark Bryan Yu
> Assignee: Niall Pemberton
> Priority: Critical
> Fix For: 1.4
>
> Attachments: fix_recursion_bug.patch
>
>
> When you attempt to copy a directory and the destination directory is inside the source directory an inifinite loop occurs in the copyDirectory causing Commons-IO to create a folder w/o stopping until its reaches OS limitation.
> This code will recreate the bug:
> FileUtils.copyDirectory(new File("C:\\temp\\test-io\\a\\."), new File("C:\\temp\\test-io\\a\\." + File.separator + new Date().getTime()));
> Make sure C:\temp\test-io\a exists
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (IO-141) Infinite loop on FileUtils.copyDirectory
when the destination directory is within the source directory
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Niall Pemberton resolved IO-141.
--------------------------------
Resolution: Fixed
Mark,
Thanks for the patch Mark, but there are two issues with it. Firstly it only resolves the recusion issue when copying to a directory directly below the destination (i.e "child"), but not for deeper levels (i.e. grandchild or below). Secondly its inconsistent IMO since it only partially copies the source directory and should IMO be ignoring only directories or files created by the copy.
I have applied an alternative solution to fix this which deals with the above two issues
http://svn.apache.org/viewvc?rev=609147&view=rev:
> Infinite loop on FileUtils.copyDirectory when the destination directory is within the source directory
> ------------------------------------------------------------------------------------------------------
>
> Key: IO-141
> URL: https://issues.apache.org/jira/browse/IO-141
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2
> Environment: Win XP
> Reporter: Mark Bryan Yu
> Assignee: Niall Pemberton
> Priority: Critical
> Fix For: 1.4
>
> Attachments: fix_recursion_bug.patch
>
>
> When you attempt to copy a directory and the destination directory is inside the source directory an inifinite loop occurs in the copyDirectory causing Commons-IO to create a folder w/o stopping until its reaches OS limitation.
> This code will recreate the bug:
> FileUtils.copyDirectory(new File("C:\\temp\\test-io\\a\\."), new File("C:\\temp\\test-io\\a\\." + File.separator + new Date().getTime()));
> Make sure C:\temp\test-io\a exists
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (IO-141) [IO][PATCH] Infinite loop on
FileUtils.copyDirectory when the destination directory is within the source
directory
Posted by "Mark Bryan Yu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Bryan Yu updated IO-141:
-----------------------------
Description:
When you attempt to copy a directory and the destination directory is inside the source directory an inifinite loop occurs in the copyDirectory causing Commons-IO to create a folder w/o stopping until its reaches OS limitation.
This code will recreate the bug:
FileUtils.copyDirectory(new File("C:\\temp\\test-io\\a\\."), new File("C:\\temp\\test-io\\a\\." + File.separator + new Date().getTime()));
Make sure C:\temp\test-io\a exists
was:
When you attempt to copy a directory and the destination directory is inside the source directory an inifinite loop occurs in the copyDirectory causing Commons-IO to create a folder w/o stopping until its reaches OS limitation.
This code will recreate the bug:
FileUtils.copyDirectory(new File("C:\\temp\\test-io\\a\\."), new File("C:\\temp\\test-io\\a\\." + File.separator + new Date().getTime()));
> [IO][PATCH] Infinite loop on FileUtils.copyDirectory when the destination directory is within the source directory
> ------------------------------------------------------------------------------------------------------------------
>
> Key: IO-141
> URL: https://issues.apache.org/jira/browse/IO-141
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2
> Environment: Win XP
> Reporter: Mark Bryan Yu
> Priority: Critical
> Attachments: Fix_recursion_bug.patch
>
>
> When you attempt to copy a directory and the destination directory is inside the source directory an inifinite loop occurs in the copyDirectory causing Commons-IO to create a folder w/o stopping until its reaches OS limitation.
> This code will recreate the bug:
> FileUtils.copyDirectory(new File("C:\\temp\\test-io\\a\\."), new File("C:\\temp\\test-io\\a\\." + File.separator + new Date().getTime()));
> Make sure C:\temp\test-io\a exists
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (IO-141) [IO][PATCH] Infinite loop on
FileUtils.copyDirectory when the destination directory is within the source
directory
Posted by "Mark Bryan Yu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Bryan Yu updated IO-141:
-----------------------------
Attachment: Fix_recursion_bug.patch
Patch to fix the recursion bug.
This patch will check the absolute path of the destination directory and the absolute path of the File objects from listFiles(). If they are equal, then don't copy the destination directory and continue the iteration
> [IO][PATCH] Infinite loop on FileUtils.copyDirectory when the destination directory is within the source directory
> ------------------------------------------------------------------------------------------------------------------
>
> Key: IO-141
> URL: https://issues.apache.org/jira/browse/IO-141
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2
> Environment: Win XP
> Reporter: Mark Bryan Yu
> Priority: Critical
> Attachments: Fix_recursion_bug.patch
>
>
> When you attempt to copy a directory and the destination directory is inside the source directory an inifinite loop occurs in the copyDirectory causing Commons-IO to create a folder w/o stopping until its reaches OS limitation.
> This code will recreate the bug:
> FileUtils.copyDirectory(new File("C:\\temp\\test-io\\a\\."), new File("C:\\temp\\test-io\\a\\." + File.separator + new Date().getTime()));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (IO-141) [IO][PATCH] Infinite loop on
FileUtils.copyDirectory when the destination directory is within the source
directory
Posted by "Mark Bryan Yu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Bryan Yu updated IO-141:
-----------------------------
Attachment: (was: Fix_recursion_bug.patch)
> [IO][PATCH] Infinite loop on FileUtils.copyDirectory when the destination directory is within the source directory
> ------------------------------------------------------------------------------------------------------------------
>
> Key: IO-141
> URL: https://issues.apache.org/jira/browse/IO-141
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2
> Environment: Win XP
> Reporter: Mark Bryan Yu
> Priority: Critical
> Attachments: fix_recursion_bug.patch
>
>
> When you attempt to copy a directory and the destination directory is inside the source directory an inifinite loop occurs in the copyDirectory causing Commons-IO to create a folder w/o stopping until its reaches OS limitation.
> This code will recreate the bug:
> FileUtils.copyDirectory(new File("C:\\temp\\test-io\\a\\."), new File("C:\\temp\\test-io\\a\\." + File.separator + new Date().getTime()));
> Make sure C:\temp\test-io\a exists
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (IO-141) [IO][PATCH] Infinite loop on
FileUtils.copyDirectory when the destination directory is within the source
directory
Posted by "Mark Bryan Yu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547306 ]
vafada edited comment on IO-141 at 12/2/07 11:43 AM:
------------------------------------------------------------
Patch to fix the recursion bug.
This patch will check the canonical path of the destination directory and the absolute path of the File objects from listFiles(). If they are equal, then don't copy the destination directory and continue the iteration
was (Author: vafada):
Patch to fix the recursion bug.
This patch will check the absolute path of the destination directory and the absolute path of the File objects from listFiles(). If they are equal, then don't copy the destination directory and continue the iteration
> [IO][PATCH] Infinite loop on FileUtils.copyDirectory when the destination directory is within the source directory
> ------------------------------------------------------------------------------------------------------------------
>
> Key: IO-141
> URL: https://issues.apache.org/jira/browse/IO-141
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2
> Environment: Win XP
> Reporter: Mark Bryan Yu
> Priority: Critical
> Attachments: fix_recursion_bug.patch
>
>
> When you attempt to copy a directory and the destination directory is inside the source directory an inifinite loop occurs in the copyDirectory causing Commons-IO to create a folder w/o stopping until its reaches OS limitation.
> This code will recreate the bug:
> FileUtils.copyDirectory(new File("C:\\temp\\test-io\\a\\."), new File("C:\\temp\\test-io\\a\\." + File.separator + new Date().getTime()));
> Make sure C:\temp\test-io\a exists
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (IO-141) [IO][PATCH] Infinite loop on
FileUtils.copyDirectory when the destination directory is within the source
directory
Posted by "Mark Bryan Yu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Bryan Yu updated IO-141:
-----------------------------
Attachment: fix_recursion_bug.patch
> [IO][PATCH] Infinite loop on FileUtils.copyDirectory when the destination directory is within the source directory
> ------------------------------------------------------------------------------------------------------------------
>
> Key: IO-141
> URL: https://issues.apache.org/jira/browse/IO-141
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.3.2
> Environment: Win XP
> Reporter: Mark Bryan Yu
> Priority: Critical
> Attachments: fix_recursion_bug.patch
>
>
> When you attempt to copy a directory and the destination directory is inside the source directory an inifinite loop occurs in the copyDirectory causing Commons-IO to create a folder w/o stopping until its reaches OS limitation.
> This code will recreate the bug:
> FileUtils.copyDirectory(new File("C:\\temp\\test-io\\a\\."), new File("C:\\temp\\test-io\\a\\." + File.separator + new Date().getTime()));
> Make sure C:\temp\test-io\a exists
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.