You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ja...@apache.org on 2018/11/13 04:25:15 UTC

[1/2] ant git commit: bz-62890 don't cache the case sensitivity of the filesystem.

Repository: ant
Updated Branches:
  refs/heads/master 033fac5b4 -> 454c252fe


bz-62890 don't cache the case sensitivity of the filesystem.

Discussed at http://mail-archives.apache.org/mod_mbox/ant-dev/201811.mbox/%3c87efbq6uym.fsf@v45346.1blu.de%3e


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/65cd88f5
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/65cd88f5
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/65cd88f5

Branch: refs/heads/master
Commit: 65cd88f59c042dd585be2c741a5ab60dd986fe25
Parents: 033fac5
Author: Jaikiran Pai <ja...@apache.org>
Authored: Tue Nov 13 09:50:13 2018 +0530
Committer: Jaikiran Pai <ja...@apache.org>
Committed: Tue Nov 13 09:50:57 2018 +0530

----------------------------------------------------------------------
 .../org/apache/tools/ant/util/FileUtils.java    | 50 ++++++++------------
 1 file changed, 19 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/65cd88f5/src/main/org/apache/tools/ant/util/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java
index d222ca9..2bbd2f3 100644
--- a/src/main/org/apache/tools/ant/util/FileUtils.java
+++ b/src/main/org/apache/tools/ant/util/FileUtils.java
@@ -81,7 +81,6 @@ public class FileUtils {
     private static final boolean ON_DOS = Os.isFamily("dos");
     private static final boolean ON_WIN9X = Os.isFamily("win9x");
     private static final boolean ON_WINDOWS = Os.isFamily("windows");
-    private static final Map<FileSystem, Boolean> fileSystemCaseSensitivity = new HashMap<>();
 
     static final int BUF_SIZE = 8192;
 
@@ -1799,40 +1798,29 @@ public class FileUtils {
         if (path == null) {
             throw new IllegalArgumentException("Path cannot be null");
         }
-        final FileSystem fileSystem = path.getFileSystem();
-        final Boolean caseSensitivity = fileSystemCaseSensitivity.get(fileSystem);
-        if (caseSensitivity != null) {
-            return Optional.of(caseSensitivity);
-        }
         final String mixedCaseFileNamePrefix = "aNt";
         Path mixedCaseTmpFile = null;
         boolean caseSensitive;
         try {
-            synchronized (fileSystemCaseSensitivity) {
-                if (fileSystemCaseSensitivity.containsKey(fileSystem)) {
-                    return Optional.of(fileSystemCaseSensitivity.get(fileSystem));
-                }
-                if (Files.isRegularFile(path)) {
-                    mixedCaseTmpFile = Files.createTempFile(path.getParent(), mixedCaseFileNamePrefix, null);
-                } else if (Files.isDirectory(path)) {
-                    mixedCaseTmpFile = Files.createTempFile(path, mixedCaseFileNamePrefix, null);
-                } else {
-                    // we can only do our tricks to figure out whether the filesystem is
-                    // case sensitive, only if the path is a directory or a file.
-                    // In other cases (like the path being non-existent), we don't
-                    // have a way to determine that detail
-                    return Optional.empty();
-                }
-                final Path lowerCasePath = Paths.get(mixedCaseTmpFile.toString().toLowerCase(Locale.US));
-                try {
-                    caseSensitive = !Files.isSameFile(mixedCaseTmpFile, lowerCasePath);
-                } catch (NoSuchFileException nsfe) {
-                    // a NSFE implies that the "lowerCasePath" file wasn't considered to be present
-                    // even if the different cased file exists. That effectively means this is a
-                    // case sensitive filesystem
-                    caseSensitive = true;
-                }
-                fileSystemCaseSensitivity.put(fileSystem, caseSensitive);
+            if (Files.isRegularFile(path)) {
+                mixedCaseTmpFile = Files.createTempFile(path.getParent(), mixedCaseFileNamePrefix, null);
+            } else if (Files.isDirectory(path)) {
+                mixedCaseTmpFile = Files.createTempFile(path, mixedCaseFileNamePrefix, null);
+            } else {
+                // we can only do our tricks to figure out whether the filesystem is
+                // case sensitive, only if the path is a directory or a file.
+                // In other cases (like the path being non-existent), we don't
+                // have a way to determine that detail
+                return Optional.empty();
+            }
+            final Path lowerCasePath = Paths.get(mixedCaseTmpFile.toString().toLowerCase(Locale.US));
+            try {
+                caseSensitive = !Files.isSameFile(mixedCaseTmpFile, lowerCasePath);
+            } catch (NoSuchFileException nsfe) {
+                // a NSFE implies that the "lowerCasePath" file wasn't considered to be present
+                // even if the different cased file exists. That effectively means this is a
+                // case sensitive filesystem
+                caseSensitive = true;
             }
         } catch (IOException ioe) {
             System.err.println("Could not determine the case sensitivity of the " +


[2/2] ant git commit: Include fix for bz-62890 in WHATSNEW

Posted by ja...@apache.org.
Include fix for bz-62890 in WHATSNEW


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/454c252f
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/454c252f
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/454c252f

Branch: refs/heads/master
Commit: 454c252fe42625200bd91d6555e241b9932853fd
Parents: 65cd88f
Author: Jaikiran Pai <ja...@apache.org>
Authored: Tue Nov 13 09:54:52 2018 +0530
Committer: Jaikiran Pai <ja...@apache.org>
Committed: Tue Nov 13 09:54:52 2018 +0530

----------------------------------------------------------------------
 WHATSNEW | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/454c252f/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 4253d63..7fd0cb4 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -27,6 +27,13 @@ Fixed bugs:
    an incorrect compression level for a zip entry. This is now fixed.
    Bugzilla Report 62686
 
+ * sync task, in some cases on case insensitive file systems, would consider
+   a file in a destination directory to be orphaned and would delete it.
+   This task has now been fixed to infer the case sensitivity of the filesystem
+   of the destination directory.
+   Bugzilla Report 62890
+
+
 Other changes:
 --------------
  * generatekey task now supports SubjectAlternativeName during key