You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2018/06/01 14:09:40 UTC

ant git commit: Bz 22370: followsymlinks must default to true for consistency

Repository: ant
Updated Branches:
  refs/heads/master f6f16d98d -> f71d39da3


Bz 22370: followsymlinks must default to true for consistency

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

Branch: refs/heads/master
Commit: f71d39da3cdb277271095145102630f3a97372f1
Parents: f6f16d9
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Fri Jun 1 16:08:42 2018 +0200
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Fri Jun 1 16:08:42 2018 +0200

----------------------------------------------------------------------
 WHATSNEW                                                  |  5 +++++
 manual/Types/selectors.html                               |  6 +++---
 .../apache/tools/ant/types/selectors/OwnedBySelector.java | 10 +++++-----
 .../tools/ant/types/selectors/PosixGroupSelector.java     | 10 +++++-----
 .../ant/types/selectors/PosixPermissionsSelector.java     | 10 +++++-----
 .../tools/ant/types/selectors/OwnedBySelectorTest.java    |  4 ++--
 .../tools/ant/types/selectors/PosixGroupSelectorTest.java |  4 ++--
 .../ant/types/selectors/PosixPermissionsSelectorTest.java |  4 ++--
 8 files changed, 29 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/f71d39da/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 63bb359..3bdab33 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -70,6 +70,11 @@ Other changes:
    can be used to specify the file's encoding.
    Bugzilla Report 62379
 
+ * New file selectors, posixGroup and posixPermissions, are available.
+   The new selectors and related ownedBy selector have "followSymlinks"
+   attribute that defaults to "true" for consistency.
+   Bugzilla Report 22370
+
 Changes from Ant 1.10.2 TO Ant 1.10.3
 =====================================
 

http://git-wip-us.apache.org/repos/asf/ant/blob/f71d39da/manual/Types/selectors.html
----------------------------------------------------------------------
diff --git a/manual/Types/selectors.html b/manual/Types/selectors.html
index e3d11b8..ef756a9 100644
--- a/manual/Types/selectors.html
+++ b/manual/Types/selectors.html
@@ -928,7 +928,7 @@
         <tr>
           <td>followsymlinks</td>
           <td>Must the selector follow symbolic links?</td>
-          <td>No; defaults to <q>false</q> (was <q>true</q> before Ant 1.10.4)</td>
+          <td>No; defaults to <q>true</q></td>
         </tr>
     </table>
 
@@ -955,7 +955,7 @@
       <tr>
         <td>followsymlinks</td>
         <td>Must the selector follow symbolic links?</td>
-        <td>No; defaults to <q>false</q></td>
+        <td>No; defaults to <q>true</q></td>
       </tr>
     </table>
 
@@ -982,7 +982,7 @@
       <tr>
         <td>followsymlinks</td>
         <td>Must the selector follow symbolic links?</td>
-        <td>No; defaults to <q>false</q></td>
+        <td>No; defaults to <q>true</q></td>
       </tr>
     </table>
 

http://git-wip-us.apache.org/repos/asf/ant/blob/f71d39da/src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java b/src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java
index f9c593b..4399aa2 100644
--- a/src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java
+++ b/src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java
@@ -42,7 +42,7 @@ public class OwnedBySelector implements FileSelector {
 
     private String owner;
 
-    private boolean followSymlinks = false;
+    private boolean followSymlinks = true;
 
     /**
      * Sets the user name to look for.
@@ -53,11 +53,11 @@ public class OwnedBySelector implements FileSelector {
     }
 
     /**
-     * Sets the "follow links" flag.
-     * @param followSymlinks the user name
+     * Sets the "follow symbolic links" option.
+     * @param followSymlinks whether or not symbolic links should be followed.
      */
-    public void setFollowSymlinks(String followSymlinks) {
-        this.followSymlinks = PropertyHelper.toBoolean(followSymlinks);
+    public void setFollowSymlinks(boolean followSymlinks) {
+        this.followSymlinks = followSymlinks;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/ant/blob/f71d39da/src/main/org/apache/tools/ant/types/selectors/PosixGroupSelector.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/selectors/PosixGroupSelector.java b/src/main/org/apache/tools/ant/types/selectors/PosixGroupSelector.java
index cdfc612..900a327 100644
--- a/src/main/org/apache/tools/ant/types/selectors/PosixGroupSelector.java
+++ b/src/main/org/apache/tools/ant/types/selectors/PosixGroupSelector.java
@@ -42,7 +42,7 @@ public class PosixGroupSelector implements FileSelector {
 
     private String group;
 
-    private boolean followSymlinks = false;
+    private boolean followSymlinks = true;
 
     /**
      * Sets the group name to look for.
@@ -53,11 +53,11 @@ public class PosixGroupSelector implements FileSelector {
     }
 
     /**
-     * Sets the "follow links" flag.
-     * @param followSymlinks the user name
+     * Sets the "follow symbolic links" option.
+     * @param followSymlinks whether or not symbolic links should be followed.
      */
-    public void setFollowSymlinks(String followSymlinks) {
-        this.followSymlinks = PropertyHelper.toBoolean(followSymlinks);
+    public void setFollowSymlinks(boolean followSymlinks) {
+        this.followSymlinks = followSymlinks;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/ant/blob/f71d39da/src/main/org/apache/tools/ant/types/selectors/PosixPermissionsSelector.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/selectors/PosixPermissionsSelector.java b/src/main/org/apache/tools/ant/types/selectors/PosixPermissionsSelector.java
index bc872ed..676646e 100644
--- a/src/main/org/apache/tools/ant/types/selectors/PosixPermissionsSelector.java
+++ b/src/main/org/apache/tools/ant/types/selectors/PosixPermissionsSelector.java
@@ -41,7 +41,7 @@ public class PosixPermissionsSelector implements FileSelector {
 
     private String permissions;
 
-    private boolean followSymlinks = false;
+    private boolean followSymlinks = true;
 
     /**
      * Sets the permissions to look for.
@@ -63,11 +63,11 @@ public class PosixPermissionsSelector implements FileSelector {
     }
 
     /**
-     * Sets the "follow links" flag.
-     * @param followSymlinks the user name
+     * Sets the "follow symbolic links" flag.
+     * @param followSymlinks whether or not symbolic links should be followed.
      */
-    public void setFollowSymlinks(String followSymlinks) {
-        this.followSymlinks = PropertyHelper.toBoolean(followSymlinks);
+    public void setFollowSymlinks(boolean followSymlinks) {
+        this.followSymlinks = followSymlinks;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/ant/blob/f71d39da/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
index 77b31dd..be0d71f 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
@@ -79,8 +79,8 @@ public class OwnedBySelectorTest {
         assertEquals(SELF, user.getName());
 
         s.setOwner(SELF);
-        assertTrue(s.isSelected(null, null, symbolicLink.toFile()));
-        s.setFollowSymlinks("yes");
         assertFalse(s.isSelected(null, null, symbolicLink.toFile()));
+        s.setFollowSymlinks(false);
+        assertTrue(s.isSelected(null, null, symbolicLink.toFile()));
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/f71d39da/src/tests/junit/org/apache/tools/ant/types/selectors/PosixGroupSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/PosixGroupSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/PosixGroupSelectorTest.java
index f9a9d62..fb5cce1 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/PosixGroupSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/PosixGroupSelectorTest.java
@@ -86,8 +86,8 @@ public class PosixGroupSelectorTest {
                 targetGroup.getName());
 
         s.setGroup(linkGroup.getName());
-        assertTrue(s.isSelected(null, null, symbolicLink.toFile()));
-        s.setFollowSymlinks("yes");
         assertFalse(s.isSelected(null, null, symbolicLink.toFile()));
+        s.setFollowSymlinks(false);
+        assertTrue(s.isSelected(null, null, symbolicLink.toFile()));
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/f71d39da/src/tests/junit/org/apache/tools/ant/types/selectors/PosixPermissionsSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/PosixPermissionsSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/PosixPermissionsSelectorTest.java
index 9aff3b5..887c34d 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/PosixPermissionsSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/PosixPermissionsSelectorTest.java
@@ -124,9 +124,9 @@ public class PosixPermissionsSelectorTest {
             Path symbolicLink = Files.createSymbolicLink(target.toPath(), TEST_FILE.toPath());
 
             s.setPermissions(argument);
-            assertFalse(s.isSelected(null, null, symbolicLink.toFile()));
-            s.setFollowSymlinks("yes");
             assertTrue(s.isSelected(null, null, symbolicLink.toFile()));
+            s.setFollowSymlinks(false);
+            assertFalse(s.isSelected(null, null, symbolicLink.toFile()));
         }
     }