HADOOP-9738. TestDistCh fails. Contributed by Jing Zhao.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1503976 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kihwal Lee 2013-07-17 02:22:14 +00:00
parent d26334b410
commit 1b6324265d
3 changed files with 9 additions and 11 deletions

View File

@ -623,6 +623,8 @@ Release 2.1.0-beta - 2013-07-02
HADOOP-9707. Fix register lists for crc32c inline assembly. (todd via
kihwal)
HADOOP-9738. TestDistCh fails. (jing9 via kihwal)
BREAKDOWN OF HADOOP-8562 SUBTASKS AND RELATED JIRAS
HADOOP-8924. Hadoop Common creating package-info.java must not depend on

View File

@ -24,8 +24,6 @@
import java.util.List;
import java.util.Stack;
import javax.security.auth.login.LoginException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
@ -47,10 +45,7 @@
import org.apache.hadoop.mapred.RecordReader;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.SequenceFileRecordReader;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.JobSubmissionFiles;
import org.apache.hadoop.mapreduce.jobhistory.JobSubmittedEvent;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.ToolRunner;

View File

@ -113,6 +113,8 @@ Path mkdir(Path dir) throws IOException {
}
static class ChPermissionStatus extends PermissionStatus {
private final boolean defaultPerm;
ChPermissionStatus(FileStatus filestatus) {
this(filestatus, "", "", "");
}
@ -121,6 +123,7 @@ static class ChPermissionStatus extends PermissionStatus {
super("".equals(owner)? filestatus.getOwner(): owner,
"".equals(group)? filestatus.getGroup(): group,
"".equals(permission)? filestatus.getPermission(): new FsPermission(Short.parseShort(permission, 8)));
defaultPerm = permission == null || "".equals(permission);
}
}
@ -141,7 +144,7 @@ public void testDistCh() throws Exception {
runLsr(shell, tree.root, 0);
final String[] args = new String[NUN_SUBS];
final PermissionStatus[] newstatus = new PermissionStatus[NUN_SUBS];
final ChPermissionStatus[] newstatus = new ChPermissionStatus[NUN_SUBS];
args[0]="/test/testDistCh/sub0:sub1::";
@ -185,13 +188,11 @@ public void testDistCh() throws Exception {
}
}
static void checkFileStatus(PermissionStatus expected, FileStatus actual) {
static void checkFileStatus(ChPermissionStatus expected, FileStatus actual) {
assertEquals(expected.getUserName(), actual.getOwner());
assertEquals(expected.getGroupName(), actual.getGroup());
FsPermission perm = expected.getPermission();
if (actual.isFile()) {
FsPermission perm = expected.getPermission();
if (actual.isFile() && expected.defaultPerm) {
perm = perm.applyUMask(UMASK);
}
assertEquals(perm, actual.getPermission());