Browse Source

check file equality before deleting dest file in case of case-insensitive

system case changing renames.  Bugzilla 37701; submitted by Anthony Goubard.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@405846 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 19 years ago
parent
commit
0c726c8860
3 changed files with 8 additions and 2 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +4
    -0
      WHATSNEW
  3. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/Move.java

+ 1
- 0
CONTRIBUTORS View File

@@ -6,6 +6,7 @@ Andreas Mross
Andrew Everitt Andrew Everitt
Anil K. Vijendran Anil K. Vijendran
Anli Shundi Anli Shundi
Anthony Goubard
Anthony Green Anthony Green
Antoine Levy-Lambert Antoine Levy-Lambert
Anton Mazkovoi Anton Mazkovoi


+ 4
- 0
WHATSNEW View File

@@ -218,6 +218,10 @@ Fixed bugs:
* <unzip> and <untar> now correctly merge multiple nested patternsets. * <unzip> and <untar> now correctly merge multiple nested patternsets.
Bugzilla Report 38973. Bugzilla Report 38973.


* On case-insensitive filesystems, a <move> to change filename case
erroneously deleted the "destination" file before attempting to rename
the source file. Bugzilla 37701.

Other changes: Other changes:
-------------- --------------
* took in bugzilla report 39320. * took in bugzilla report 39320.


+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/Move.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2005 The Apache Software Foundation
* Copyright 2000-2006 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -373,7 +373,8 @@ public class Move extends Copy {
if (parent != null && !parent.exists()) { if (parent != null && !parent.exists()) {
parent.mkdirs(); parent.mkdirs();
} }
if (destFile.isFile() && !destFile.delete()) {
if (destFile.isFile() && !destFile.equals(sourceFile)
&& !destFile.delete()) {
throw new BuildException("Unable to remove existing " throw new BuildException("Unable to remove existing "
+ "file " + destFile); + "file " + destFile);
} }


Loading…
Cancel
Save