diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index b7fa2bc7f9..6691880da8 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -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 diff --git a/hadoop-tools/hadoop-extras/src/main/java/org/apache/hadoop/tools/DistCh.java b/hadoop-tools/hadoop-extras/src/main/java/org/apache/hadoop/tools/DistCh.java index 0606fa9f19..8779e06555 100644 --- a/hadoop-tools/hadoop-extras/src/main/java/org/apache/hadoop/tools/DistCh.java +++ b/hadoop-tools/hadoop-extras/src/main/java/org/apache/hadoop/tools/DistCh.java @@ -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; diff --git a/hadoop-tools/hadoop-extras/src/test/java/org/apache/hadoop/tools/TestDistCh.java b/hadoop-tools/hadoop-extras/src/test/java/org/apache/hadoop/tools/TestDistCh.java index 53f20b2aec..79265e6093 100644 --- a/hadoop-tools/hadoop-extras/src/test/java/org/apache/hadoop/tools/TestDistCh.java +++ b/hadoop-tools/hadoop-extras/src/test/java/org/apache/hadoop/tools/TestDistCh.java @@ -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());