diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 95d8f40ecc..003e6a381c 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -333,6 +333,8 @@ Trunk (Unreleased) HADOOP-10354. TestWebHDFS fails after merge of HDFS-4685 to trunk. (cnauroth) + HADOOP-10361. Correct alignment in CLI output for ACLs. (cnauroth) + OPTIMIZATIONS HADOOP-7761. Improve the performance of raw comparisons. (todd) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java index 6e10e7223e..f17457cafd 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java @@ -171,7 +171,7 @@ private void printExtendedAclEntry(AclEntry entry, FsAction maskPerm) { FsAction entryPerm = entry.getPermission(); FsAction effectivePerm = entryPerm.and(maskPerm); if (entryPerm != effectivePerm) { - out.println(String.format("%-31s #effective:%s", entry, + out.println(String.format("%s\t#effective:%s", entry, effectivePerm.SYMBOL)); } else { out.println(entry); diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java index c5ee933ea1..a41be7ef2a 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java @@ -67,8 +67,7 @@ public static void registerCommands(CommandFactory factory) { protected static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - protected int maxPerm = 9, maxRepl = 3, maxLen = 10, maxOwner = 0, - maxGroup = 0; + protected int maxRepl = 3, maxLen = 10, maxOwner = 0, maxGroup = 0; protected String lineFormat; protected boolean dirRecurse; @@ -117,7 +116,7 @@ protected void processPath(PathData item) throws IOException { FileStatus stat = item.stat; String line = String.format(lineFormat, (stat.isDirectory() ? "d" : "-"), - stat.getPermission() + (hasAcl(item) ? "+" : ""), + stat.getPermission() + (hasAcl(item) ? "+" : " "), (stat.isFile() ? stat.getReplication() : "-"), stat.getOwner(), stat.getGroup(), @@ -135,7 +134,6 @@ protected void processPath(PathData item) throws IOException { private void adjustColumnWidths(PathData items[]) { for (PathData item : items) { FileStatus stat = item.stat; - maxPerm = maxLength(maxPerm, stat.getPermission()); maxRepl = maxLength(maxRepl, stat.getReplication()); maxLen = maxLength(maxLen, stat.getLen()); maxOwner = maxLength(maxOwner, stat.getOwner()); @@ -143,7 +141,7 @@ private void adjustColumnWidths(PathData items[]) { } StringBuilder fmt = new StringBuilder(); - fmt.append("%s%-" + maxPerm + "s "); // permission string + fmt.append("%s%s"); // permission string fmt.append("%" + maxRepl + "s "); // Do not use '%-0s' as a formatting conversion, since it will throw a // a MissingFormatWidthException if it is used in String.format(). diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testAclCLI.xml b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testAclCLI.xml index a7491511be..c01c56d46a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testAclCLI.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testAclCLI.xml @@ -846,15 +846,15 @@ RegexpComparator - ^user:charlie:rwx\s+#effective:r-x$ + ^user:charlie:rwx\t#effective:r-x$ RegexpComparator - ^group::-wx\s+#effective:--x$ + ^group::-wx\t#effective:--x$ RegexpComparator - ^group:sales:rwx\s+#effective:r-x$ + ^group:sales:rwx\t#effective:r-x$ SubstringComparator @@ -870,15 +870,15 @@ RegexpComparator - ^default:user:charlie:rwx\s+#effective:rw-$ + ^default:user:charlie:rwx\t#effective:rw-$ RegexpComparator - ^default:group::r-x\s+#effective:r--$ + ^default:group::r-x\t#effective:r--$ RegexpComparator - ^default:group:sales:rwx\s+#effective:rw-$ + ^default:group:sales:rwx\t#effective:rw-$ SubstringComparator