POSIX tar specifies 64-bit UID/GID

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

Branch: refs/heads/master
Commit: 02adb467e426de1a62a76105c36ecd645b1024bd
Parents: dccbf1f
Author: Gintas Grigelionis <gin...@apache.org>
Authored: Thu Apr 5 07:29:33 2018 +0200
Committer: Gintas Grigelionis <gin...@apache.org>
Committed: Thu Apr 5 07:29:33 2018 +0200

----------------------------------------------------------------------
 src/main/org/apache/tools/ant/taskdefs/Tar.java |  4 +--
 .../tools/ant/types/resources/TarResource.java  | 34 +++++++++++++++-----
 2 files changed, 28 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/02adb467/src/main/org/apache/tools/ant/taskdefs/Tar.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Tar.java 
b/src/main/org/apache/tools/ant/taskdefs/Tar.java
index 51bb8cd..737e68c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Tar.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Tar.java
@@ -461,9 +461,9 @@ public class Tar extends MatchingTask {
             if (r instanceof TarResource) {
                 final TarResource tr = (TarResource) r;
                 te.setUserName(tr.getUserName());
-                te.setUserId(tr.getUid());
+                te.setUserId(tr.getLongUid());
                 te.setGroupName(tr.getGroup());
-                te.setGroupId(tr.getGid());
+                te.setGroupId(tr.getLongGid());
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/02adb467/src/main/org/apache/tools/ant/types/resources/TarResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/TarResource.java 
b/src/main/org/apache/tools/ant/types/resources/TarResource.java
index 36b0e38..1279bd8 100644
--- a/src/main/org/apache/tools/ant/types/resources/TarResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/TarResource.java
@@ -37,8 +37,8 @@ public class TarResource extends ArchiveResource {
 
     private String userName = "";
     private String groupName = "";
-    private int    uid;
-    private int    gid;
+    private long   uid;
+    private long   gid;
 
     /**
      * Default constructor.
@@ -134,27 +134,45 @@ public class TarResource extends ArchiveResource {
 
     /**
      * @return the uid for the tar entry
+     * @since 1.10.4
      */
-    public int getUid() {
+    public long getLongUid() {
         if (isReference()) {
-            return getCheckedRef().getUid();
+            return getCheckedRef().getLongUid();
         }
         checkEntry();
         return uid;
     }
 
     /**
+     * @return the uid for the tar entry
+     */
+    @Deprecated
+    public int getUid() {
+        return (int) getLongUid();
+    }
+
+    /**
      * @return the gid for the tar entry
+     * @since 1.10.4
      */
-    public int getGid() {
+    public long getLongGid() {
         if (isReference()) {
-            return getCheckedRef().getGid();
+            return getCheckedRef().getLongGid();
         }
         checkEntry();
         return gid;
     }
 
     /**
+     * @return the uid for the tar entry
+     */
+    @Deprecated
+    public int getGid() {
+        return (int) getLongGid();
+    }
+
+    /**
      * fetches information from the named entry inside the archive.
      */
     @Override
@@ -194,8 +212,8 @@ public class TarResource extends ArchiveResource {
         setMode(e.getMode());
         userName = e.getUserName();
         groupName = e.getGroupName();
-        uid = e.getUserId();
-        gid = e.getGroupId();
+        uid = e.getLongUserId();
+        gid = e.getLongGroupId();
     }
 
 }

Reply via email to