[ 
https://issues.apache.org/jira/browse/IO-769?focusedWorklogId=806040&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-806040
 ]

ASF GitHub Bot logged work on IO-769:
-------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Sep/22 16:23
            Start Date: 04/Sep/22 16:23
    Worklog Time Spent: 10m 
      Work Description: tresf commented on PR #377:
URL: https://github.com/apache/commons-io/pull/377#issuecomment-1236373760

   > Notice that in the (old) Jira tickets above, two are about attributes not 
being copied, which we now do but this PR proposes to undo. So catch-22. Ideas?
   
   The API already offers `COPY_ATTRIBUTES` in several APIs as `CopyOptions` 
parameters.  Note, the current API doesn't allow the removal of the assumed 
`COPY_ATTRIBUTES` and if you look at the history of the StackOverflow and 
mailing list posts, this is often the first instinct, e.g:
   1. User doesn't get desired copy behavior
   2. Community recommends adjusting `CopyOptions`
   
   ... however the current behavior doesn't give this control to the user, 
despite it being the first instinct by the community, quoting:
   
   > **Gary wrote:** Use `org.apache.commons.io.FileUtils.copyFile(File, File, 
boolean, CopyOption...)` to exercise full control over what you want to do. 
Under the covers it ends up calling `java.nio.file.Files.copy(Path, Path, 
CopyOption...)`.
   
   So if this regression is not reverted, I'd at least advocate for an API 
which would make the above statement correct.  The current behavior silently 
adds `COPY_ATTRIBUTES`, which removes the ability to control this flag.




Issue Time Tracking
-------------------

    Worklog Id:     (was: 806040)
    Time Spent: 40m  (was: 0.5h)

> FileUtils.copyFileToDirectory can lead to not accessible file when preserving 
> the file date
> -------------------------------------------------------------------------------------------
>
>                 Key: IO-769
>                 URL: https://issues.apache.org/jira/browse/IO-769
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.11.0
>            Reporter: Jérémy Carnus
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Hi,
> The current implementation for copyFileToDirectory by default preserve the 
> file. 
> There 2 issues regarding this:
>  * the javadoc mentions this is done by File.setLastModified by in fact this 
> is done by the COPY_ATTRIBUTES options
>  * Under Windows, the COPY_ATTRIBUTES also copies the security attributes 
> (SID and permissions) and can lead to a file not beeing readable after copy 
> (if for example, you copie from a mount under docker or a shared folder)
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to