HADOOP-10241. Clean up output of FsShell getfacl. Contributed by Chris Nauroth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-4685@1560194 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Haohui Mai 2014-01-21 21:20:39 +00:00
parent 2af05fb1cf
commit 21a5bc7f2c
3 changed files with 8 additions and 3 deletions

View File

@ -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();
}
/**

View File

@ -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().

View File

@ -42,6 +42,8 @@ HDFS-4685 (Unreleased)
HDFS-5615. NameNode: implement handling of ACLs in combination with sticky
bit. (Chris Nauroth via wheat9)
HADOOP-10241. Clean up output of FsShell getfacl. (Chris Nauroth via wheat9)
OPTIMIZATIONS
BUG FIXES