Browse Source

POSIX tar specifies 64-bit UID/GID

master
Gintas Grigelionis 7 years ago
parent
commit
02adb467e4
2 changed files with 28 additions and 10 deletions
  1. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Tar.java
  2. +26
    -8
      src/main/org/apache/tools/ant/types/resources/TarResource.java

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

@@ -461,9 +461,9 @@ public class Tar extends MatchingTask {
if (r instanceof TarResource) { if (r instanceof TarResource) {
final TarResource tr = (TarResource) r; final TarResource tr = (TarResource) r;
te.setUserName(tr.getUserName()); te.setUserName(tr.getUserName());
te.setUserId(tr.getUid());
te.setUserId(tr.getLongUid());
te.setGroupName(tr.getGroup()); te.setGroupName(tr.getGroup());
te.setGroupId(tr.getGid());
te.setGroupId(tr.getLongGid());
} }
} }




+ 26
- 8
src/main/org/apache/tools/ant/types/resources/TarResource.java View File

@@ -37,8 +37,8 @@ public class TarResource extends ArchiveResource {


private String userName = ""; private String userName = "";
private String groupName = ""; private String groupName = "";
private int uid;
private int gid;
private long uid;
private long gid;


/** /**
* Default constructor. * Default constructor.
@@ -134,26 +134,44 @@ public class TarResource extends ArchiveResource {


/** /**
* @return the uid for the tar entry * @return the uid for the tar entry
* @since 1.10.4
*/ */
public int getUid() {
public long getLongUid() {
if (isReference()) { if (isReference()) {
return getCheckedRef().getUid();
return getCheckedRef().getLongUid();
} }
checkEntry(); checkEntry();
return uid; return uid;
} }


/**
* @return the uid for the tar entry
*/
@Deprecated
public int getUid() {
return (int) getLongUid();
}

/** /**
* @return the gid for the tar entry * @return the gid for the tar entry
* @since 1.10.4
*/ */
public int getGid() {
public long getLongGid() {
if (isReference()) { if (isReference()) {
return getCheckedRef().getGid();
return getCheckedRef().getLongGid();
} }
checkEntry(); checkEntry();
return gid; 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. * fetches information from the named entry inside the archive.
*/ */
@@ -194,8 +212,8 @@ public class TarResource extends ArchiveResource {
setMode(e.getMode()); setMode(e.getMode());
userName = e.getUserName(); userName = e.getUserName();
groupName = e.getGroupName(); groupName = e.getGroupName();
uid = e.getUserId();
gid = e.getGroupId();
uid = e.getLongUserId();
gid = e.getLongGroupId();
} }


} }

Loading…
Cancel
Save