[17/50] [abbrv] hadoop git commit: HADOOP-13522. Add %A and %a formats for fs -stat command to print permissions. Contributed by Alex Garbarini.

2016-10-21 Thread aengineer
HADOOP-13522. Add %A and %a formats for fs -stat command to print permissions. 
Contributed by Alex Garbarini.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/bedfec0c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/bedfec0c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/bedfec0c

Branch: refs/heads/HDFS-7240
Commit: bedfec0c10144087168bc79501ffd5ab4fa52606
Parents: 0bc6d37
Author: Akira Ajisaka 
Authored: Tue Oct 18 14:37:32 2016 +0900
Committer: Akira Ajisaka 
Committed: Tue Oct 18 15:00:44 2016 +0900

--
 .../hadoop/fs/permission/FsPermission.java  | 12 
 .../java/org/apache/hadoop/fs/shell/Stat.java   | 11 ++-
 .../src/site/markdown/FileSystemShell.md|  4 ++--
 .../src/test/resources/testConf.xml |  6 +-
 .../org/apache/hadoop/hdfs/TestDFSShell.java| 20 +---
 5 files changed, 46 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/bedfec0c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
index 48a5b1c..fabfc12 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
@@ -183,6 +183,18 @@ public class FsPermission implements Writable {
 return toShort();
   }
 
+  /**
+   * Returns the FsPermission in an octal format.
+   *
+   * @return short Unlike {@link #toShort()} which provides a binary
+   * representation, this method returns the standard octal style permission.
+   */
+  public short toOctal() {
+int n = this.toShort();
+int octal = (n>>>9&1)*1000 + (n>>>6&7)*100 + (n>>>3&7)*10 + (n&7);
+return (short)octal;
+  }
+
   @Override
   public boolean equals(Object obj) {
 if (obj instanceof FsPermission) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/bedfec0c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
index 458d3ee..42f7843 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
@@ -31,6 +31,8 @@ import org.apache.hadoop.fs.FileStatus;
 /**
  * Print statistics about path in specified format.
  * Format sequences:
+ *   %a: Permissions in octal
+ *   %A: Permissions in symbolic style
  *   %b: Size of file in blocks
  *   %F: Type
  *   %g: Group name of owner
@@ -56,7 +58,8 @@ class Stat extends FsCommand {
   public static final String USAGE = "[format]  ...";
   public static final String DESCRIPTION =
 "Print statistics about the file/directory at " + NEWLINE +
-"in the specified format. Format accepts filesize in" + NEWLINE +
+"in the specified format. Format accepts permissions in" + NEWLINE +
+"octal (%a) and symbolic (%A), filesize in" + NEWLINE +
 "blocks (%b), type (%F), group name of owner (%g)," + NEWLINE +
 "name (%n), block size (%o), replication (%r), user name" + NEWLINE +
 "of owner (%u), modification date (%y, %Y)." + NEWLINE +
@@ -95,6 +98,12 @@ class Stat extends FsCommand {
 // this silently drops a trailing %?
 if (i + 1 == fmt.length) break;
 switch (fmt[++i]) {
+  case 'a':
+buf.append(stat.getPermission().toOctal());
+break;
+  case 'A':
+buf.append(stat.getPermission());
+break;
   case 'b':
 buf.append(stat.getLen());
 break;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/bedfec0c/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
--
diff --git 
a/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md 
b/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
index ee7bc28..060c775 100644
--- a/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
+++ b/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
@@ -639,11 +639,11 @@ stat
 
 

[39/50] [abbrv] hadoop git commit: HADOOP-13522. Add %A and %a formats for fs -stat command to print permissions. Contributed by Alex Garbarini.

2016-10-18 Thread sjlee
HADOOP-13522. Add %A and %a formats for fs -stat command to print permissions. 
Contributed by Alex Garbarini.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/bedfec0c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/bedfec0c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/bedfec0c

Branch: refs/heads/HADOOP-13070
Commit: bedfec0c10144087168bc79501ffd5ab4fa52606
Parents: 0bc6d37
Author: Akira Ajisaka 
Authored: Tue Oct 18 14:37:32 2016 +0900
Committer: Akira Ajisaka 
Committed: Tue Oct 18 15:00:44 2016 +0900

--
 .../hadoop/fs/permission/FsPermission.java  | 12 
 .../java/org/apache/hadoop/fs/shell/Stat.java   | 11 ++-
 .../src/site/markdown/FileSystemShell.md|  4 ++--
 .../src/test/resources/testConf.xml |  6 +-
 .../org/apache/hadoop/hdfs/TestDFSShell.java| 20 +---
 5 files changed, 46 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/bedfec0c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
index 48a5b1c..fabfc12 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
@@ -183,6 +183,18 @@ public class FsPermission implements Writable {
 return toShort();
   }
 
+  /**
+   * Returns the FsPermission in an octal format.
+   *
+   * @return short Unlike {@link #toShort()} which provides a binary
+   * representation, this method returns the standard octal style permission.
+   */
+  public short toOctal() {
+int n = this.toShort();
+int octal = (n>>>9&1)*1000 + (n>>>6&7)*100 + (n>>>3&7)*10 + (n&7);
+return (short)octal;
+  }
+
   @Override
   public boolean equals(Object obj) {
 if (obj instanceof FsPermission) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/bedfec0c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
index 458d3ee..42f7843 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
@@ -31,6 +31,8 @@ import org.apache.hadoop.fs.FileStatus;
 /**
  * Print statistics about path in specified format.
  * Format sequences:
+ *   %a: Permissions in octal
+ *   %A: Permissions in symbolic style
  *   %b: Size of file in blocks
  *   %F: Type
  *   %g: Group name of owner
@@ -56,7 +58,8 @@ class Stat extends FsCommand {
   public static final String USAGE = "[format]  ...";
   public static final String DESCRIPTION =
 "Print statistics about the file/directory at " + NEWLINE +
-"in the specified format. Format accepts filesize in" + NEWLINE +
+"in the specified format. Format accepts permissions in" + NEWLINE +
+"octal (%a) and symbolic (%A), filesize in" + NEWLINE +
 "blocks (%b), type (%F), group name of owner (%g)," + NEWLINE +
 "name (%n), block size (%o), replication (%r), user name" + NEWLINE +
 "of owner (%u), modification date (%y, %Y)." + NEWLINE +
@@ -95,6 +98,12 @@ class Stat extends FsCommand {
 // this silently drops a trailing %?
 if (i + 1 == fmt.length) break;
 switch (fmt[++i]) {
+  case 'a':
+buf.append(stat.getPermission().toOctal());
+break;
+  case 'A':
+buf.append(stat.getPermission());
+break;
   case 'b':
 buf.append(stat.getLen());
 break;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/bedfec0c/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
--
diff --git 
a/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md 
b/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
index ee7bc28..060c775 100644
--- a/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
+++ b/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
@@ -639,11 +639,11 @@ stat
 
 

hadoop git commit: HADOOP-13522. Add %A and %a formats for fs -stat command to print permissions. Contributed by Alex Garbarini.

2016-10-18 Thread aajisaka
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 278eeb105 -> b2618685f


HADOOP-13522. Add %A and %a formats for fs -stat command to print permissions. 
Contributed by Alex Garbarini.

(cherry picked from commit bedfec0c10144087168bc79501ffd5ab4fa52606)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b2618685
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b2618685
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b2618685

Branch: refs/heads/branch-2
Commit: b2618685fb8defd158ab06656191f958fba09043
Parents: 278eeb1
Author: Akira Ajisaka 
Authored: Tue Oct 18 14:37:32 2016 +0900
Committer: Akira Ajisaka 
Committed: Tue Oct 18 15:03:33 2016 +0900

--
 .../hadoop/fs/permission/FsPermission.java  | 12 
 .../java/org/apache/hadoop/fs/shell/Stat.java   | 11 ++-
 .../src/site/markdown/FileSystemShell.md|  4 ++--
 .../src/test/resources/testConf.xml |  6 +-
 .../org/apache/hadoop/hdfs/TestDFSShell.java| 20 +---
 5 files changed, 46 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b2618685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
index 0258293..c4e377a 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
@@ -169,6 +169,18 @@ public class FsPermission implements Writable {
 return toShort();
   }
 
+  /**
+   * Returns the FsPermission in an octal format.
+   *
+   * @return short Unlike {@link #toShort()} which provides a binary
+   * representation, this method returns the standard octal style permission.
+   */
+  public short toOctal() {
+int n = this.toShort();
+int octal = (n>>>9&1)*1000 + (n>>>6&7)*100 + (n>>>3&7)*10 + (n&7);
+return (short)octal;
+  }
+
   @Override
   public boolean equals(Object obj) {
 if (obj instanceof FsPermission) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b2618685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
index 458d3ee..42f7843 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
@@ -31,6 +31,8 @@ import org.apache.hadoop.fs.FileStatus;
 /**
  * Print statistics about path in specified format.
  * Format sequences:
+ *   %a: Permissions in octal
+ *   %A: Permissions in symbolic style
  *   %b: Size of file in blocks
  *   %F: Type
  *   %g: Group name of owner
@@ -56,7 +58,8 @@ class Stat extends FsCommand {
   public static final String USAGE = "[format]  ...";
   public static final String DESCRIPTION =
 "Print statistics about the file/directory at " + NEWLINE +
-"in the specified format. Format accepts filesize in" + NEWLINE +
+"in the specified format. Format accepts permissions in" + NEWLINE +
+"octal (%a) and symbolic (%A), filesize in" + NEWLINE +
 "blocks (%b), type (%F), group name of owner (%g)," + NEWLINE +
 "name (%n), block size (%o), replication (%r), user name" + NEWLINE +
 "of owner (%u), modification date (%y, %Y)." + NEWLINE +
@@ -95,6 +98,12 @@ class Stat extends FsCommand {
 // this silently drops a trailing %?
 if (i + 1 == fmt.length) break;
 switch (fmt[++i]) {
+  case 'a':
+buf.append(stat.getPermission().toOctal());
+break;
+  case 'A':
+buf.append(stat.getPermission());
+break;
   case 'b':
 buf.append(stat.getLen());
 break;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b2618685/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
--
diff --git 
a/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md 
b/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
index 1d4174c..df0bb6c 100644
--- 

hadoop git commit: HADOOP-13522. Add %A and %a formats for fs -stat command to print permissions. Contributed by Alex Garbarini.

2016-10-18 Thread aajisaka
Repository: hadoop
Updated Branches:
  refs/heads/trunk 0bc6d37f3 -> bedfec0c1


HADOOP-13522. Add %A and %a formats for fs -stat command to print permissions. 
Contributed by Alex Garbarini.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/bedfec0c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/bedfec0c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/bedfec0c

Branch: refs/heads/trunk
Commit: bedfec0c10144087168bc79501ffd5ab4fa52606
Parents: 0bc6d37
Author: Akira Ajisaka 
Authored: Tue Oct 18 14:37:32 2016 +0900
Committer: Akira Ajisaka 
Committed: Tue Oct 18 15:00:44 2016 +0900

--
 .../hadoop/fs/permission/FsPermission.java  | 12 
 .../java/org/apache/hadoop/fs/shell/Stat.java   | 11 ++-
 .../src/site/markdown/FileSystemShell.md|  4 ++--
 .../src/test/resources/testConf.xml |  6 +-
 .../org/apache/hadoop/hdfs/TestDFSShell.java| 20 +---
 5 files changed, 46 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/bedfec0c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
index 48a5b1c..fabfc12 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
@@ -183,6 +183,18 @@ public class FsPermission implements Writable {
 return toShort();
   }
 
+  /**
+   * Returns the FsPermission in an octal format.
+   *
+   * @return short Unlike {@link #toShort()} which provides a binary
+   * representation, this method returns the standard octal style permission.
+   */
+  public short toOctal() {
+int n = this.toShort();
+int octal = (n>>>9&1)*1000 + (n>>>6&7)*100 + (n>>>3&7)*10 + (n&7);
+return (short)octal;
+  }
+
   @Override
   public boolean equals(Object obj) {
 if (obj instanceof FsPermission) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/bedfec0c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
index 458d3ee..42f7843 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
@@ -31,6 +31,8 @@ import org.apache.hadoop.fs.FileStatus;
 /**
  * Print statistics about path in specified format.
  * Format sequences:
+ *   %a: Permissions in octal
+ *   %A: Permissions in symbolic style
  *   %b: Size of file in blocks
  *   %F: Type
  *   %g: Group name of owner
@@ -56,7 +58,8 @@ class Stat extends FsCommand {
   public static final String USAGE = "[format]  ...";
   public static final String DESCRIPTION =
 "Print statistics about the file/directory at " + NEWLINE +
-"in the specified format. Format accepts filesize in" + NEWLINE +
+"in the specified format. Format accepts permissions in" + NEWLINE +
+"octal (%a) and symbolic (%A), filesize in" + NEWLINE +
 "blocks (%b), type (%F), group name of owner (%g)," + NEWLINE +
 "name (%n), block size (%o), replication (%r), user name" + NEWLINE +
 "of owner (%u), modification date (%y, %Y)." + NEWLINE +
@@ -95,6 +98,12 @@ class Stat extends FsCommand {
 // this silently drops a trailing %?
 if (i + 1 == fmt.length) break;
 switch (fmt[++i]) {
+  case 'a':
+buf.append(stat.getPermission().toOctal());
+break;
+  case 'A':
+buf.append(stat.getPermission());
+break;
   case 'b':
 buf.append(stat.getLen());
 break;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/bedfec0c/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
--
diff --git 
a/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md 
b/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
index ee7bc28..060c775 100644
--- a/hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md
+++