Author: wheat9
Date: Tue Jan 21 21:20:39 2014
New Revision: 1560194
URL: http://svn.apache.org/r1560194
Log:
HADOOP-10241. Clean up output of FsShell getfacl. Contributed by Chris Nauroth.
Modified:
hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java
hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
Modified:
hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java?rev=1560194&r1=1560193&r2=1560194&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java
(original)
+++
hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java
Tue Jan 21 21:20:39 2014
@@ -74,7 +74,7 @@ class AclCommands extends FsCommand {
@Override
protected void processPath(PathData item) throws IOException {
AclStatus aclStatus = item.fs.getAclStatus(item.path);
- out.println("# file: " + item.path);
+ out.println("# file: " + item);
out.println("# owner: " + aclStatus.getOwner());
out.println("# group: " + aclStatus.getGroup());
List<AclEntry> entries = aclStatus.getEntries();
@@ -97,6 +97,7 @@ class AclCommands extends FsCommand {
} else {
printMinimalAcl(perm);
}
+ out.println();
}
/**
Modified:
hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java?rev=1560194&r1=1560193&r2=1560194&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
(original)
+++
hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
Tue Jan 21 21:20:39 2014
@@ -60,7 +60,8 @@ class Ls extends FsCommand {
protected static final SimpleDateFormat dateFormat =
new SimpleDateFormat("yyyy-MM-dd HH:mm");
- protected int maxRepl = 3, maxLen = 10, maxOwner = 0, maxGroup = 0;
+ protected int maxPerm = 9, maxRepl = 3, maxLen = 10, maxOwner = 0,
+ maxGroup = 0;
protected String lineFormat;
protected boolean dirRecurse;
@@ -125,6 +126,7 @@ class Ls extends FsCommand {
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());
@@ -132,7 +134,7 @@ class Ls extends FsCommand {
}
StringBuilder fmt = new StringBuilder();
- fmt.append("%s%s "); // permission string
+ fmt.append("%s%-" + maxPerm + "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().