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
Anil K. Vijendran
Anli Shundi
Anthony Goubard
Anthony Green
Antoine Levy-Lambert
Anton Mazkovoi


+ 4
- 0
WHATSNEW View File

@@ -218,6 +218,10 @@ Fixed bugs:
* <unzip> and <untar> now correctly merge multiple nested patternsets.
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:
--------------
* 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");
* 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()) {
parent.mkdirs();
}
if (destFile.isFile() && !destFile.delete()) {
if (destFile.isFile() && !destFile.equals(sourceFile)
&& !destFile.delete()) {
throw new BuildException("Unable to remove existing "
+ "file " + destFile);
}


Loading…
Cancel
Save