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:
parent
2af05fb1cf
commit
21a5bc7f2c
@ -74,7 +74,7 @@ protected void processOptions(LinkedList<String> args) throws IOException {
|
||||
@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 @@ protected void processPath(PathData item) throws IOException {
|
||||
} else {
|
||||
printMinimalAcl(perm);
|
||||
}
|
||||
out.println();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,8 @@ public static void registerCommands(CommandFactory factory) {
|
||||
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 @@ 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());
|
||||
@ -132,7 +134,7 @@ private void adjustColumnWidths(PathData items[]) {
|
||||
}
|
||||
|
||||
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().
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user