diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index fa9f7726754..26f297ad3fc 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -347,6 +347,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 0606fa9f198..8779e065554 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.ArrayList; 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.OutputCollector; 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 53f20b2aec8..79265e60938 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 @@ public class TestDistCh extends junit.framework.TestCase { } static class ChPermissionStatus extends PermissionStatus { + private final boolean defaultPerm; + ChPermissionStatus(FileStatus filestatus) { this(filestatus, "", "", ""); } @@ -121,6 +123,7 @@ public class TestDistCh extends junit.framework.TestCase { 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 class TestDistCh extends junit.framework.TestCase { 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 class TestDistCh extends junit.framework.TestCase { } } - - - 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());