[GRADLE-3111] Copy w/DuplicatesStrategy.EXCLUDE overwrites files Created: 23/Jun/14  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 0


 Description   

Hi there

I've apparently found a potentially serious problem in the copy task, Gradle v. 1.12.

When copying files with the duplicatesStrategy= DuplicatesStrategy.EXCLUDE, it will overwrite files with different case on file systems with case insentitive file names.

e.g. (pseudo-code-ish..)

task copySomeFiles(type: Copy)

{ duplicatesStrategy= DuplicatesStrategy.EXCLUDE from 'somePath/readme.txt' from 'anotherpath/README.TXT' into destination } will result in destination/readme.txt having the content of README.TXT. Kind regards, Povl }

 Comments   
Comment by Gradle Forums [ 23/Jun/14 ]

so what should Gradle do? If you want to have these files residing in different folders, you have to tell it explicitely.

Comment by Gradle Forums [ 23/Jun/14 ]

I am aware that this may not be a trivial problem, but DuplicatesStrategy.EXCLUDE clearly states that files should not be overwritten. This appears not to be the case.

I don't know how Gradle determines if two file names are the same, but a simple string compare is not enough to determine if two file names will end up being the same file in the file system. It depends on how the file system handles upper/lowercase characters.

Comment by Gradle Forums [ 23/Jun/14 ]

See [java.io.File.equals]([1]http://docs.oracle.com/javase/7/docs/...):

public boolean equals(Object obj)

Tests this abstract pathname for equality with the given object. Returns true if and only if the argument is not null and is an abstract pathname that denotes the same file or directory as this abstract pathname. Whether or not two abstract pathnames are equal depends upon the underlying system. On UNIX systems, alphabetic case is significant in comparing pathnames; on Microsoft Windows systems it is not.
----------------------------------------------------------------------------------------
[1] http://docs.oracle.com/javase/7/docs/api/java/io/File.html#equals(java.lang.Object)

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:40:17 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.