https://issues.apache.org/bugzilla/show_bug.cgi?id=49261
Summary: Copy task fails to overwrite readonly files even with
overwrite="true"
Product: Ant
Version: 1.8.0
Platform: Macintosh
Status: NEW
Severity: regression
Priority: P2
Component: Core tasks
AssignedTo: [email protected]
ReportedBy: [email protected]
The copy task in prior versions (I tried 1.7.0 & 1.7.1) allowed one to
overwrite a read-only file if overwrite="true" was set. Now it seems that in
1.8.0 that no longer works and results in an exception:
/private/tmp/build.xml:3: Failed to copy /private/tmp/source to
/private/tmp/dest due to java.io.FileNotFoundException /private/tmp/dest
(Permission denied)
My steps to reproduce are below.
$ whoami
cquinn
$ echo 'The quick brown fox jumped over the lazy dog.' > source
$ touch dest; chmod -w dest
$ ls -l source dest
-r--r--r-- 1 cquinn wheel 0 May 6 14:39 dest
-rw-r--r-- 1 cquinn wheel 46 May 6 14:35 source
$ cat build.xml
<project default="bug">
<target name="bug">
<copy file="source" tofile="dest" overwrite="true"/>
</target>
</project>
$ ant -version
Apache Ant version 1.8.0 compiled on February 1 2010
$ ant
Buildfile: /private/tmp/build.xml
bug:
[copy] Copying 1 file to /private/tmp
BUILD FAILED
/private/tmp/build.xml:3: Failed to copy /private/tmp/source to
/private/tmp/dest due to java.io.FileNotFoundException /private/tmp/dest
(Permission denied)
$ ls -l source dest
ls: dest: No such file or directory
-rw-r--r-- 1 cquinn wheel 46 May 6 14:35 source
>> Note that it not only failed to copy, but it removed the file.
>> Now, put the dest file back and switch ants to show how it used to work:
$ touch dest; chmod -w dest
$ ant -version
Apache Ant version 1.7.1 compiled on June 27 2008
$ ant
Buildfile: build.xml
bug:
[copy] Copying 1 file to /private/tmp
BUILD SUCCESSFUL
Total time: 0 seconds
$ ls -l source dest
-rw-r--r-- 1 cquinn wheel 46 May 6 14:57 dest
-rw-r--r-- 1 cquinn wheel 46 May 6 14:35 source
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.