hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1422288 - in /hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common: CHANGES.branch-trunk-win.txt src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
Date Sat, 15 Dec 2012 17:00:44 GMT
Author: suresh
Date: Sat Dec 15 17:00:43 2012
New Revision: 1422288

URL: http://svn.apache.org/viewvc?rev=1422288&view=rev
Log:
HADOOP-9146. Fix sticky bit regression on branch-trunk-win. Contributed by Chris Nauroth.

Modified:
    hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/CHANGES.branch-trunk-win.txt
    hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java

Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/CHANGES.branch-trunk-win.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/CHANGES.branch-trunk-win.txt?rev=1422288&r1=1422287&r2=1422288&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/CHANGES.branch-trunk-win.txt
(original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/CHANGES.branch-trunk-win.txt
Sat Dec 15 17:00:43 2012
@@ -69,3 +69,6 @@ branch-trunk-win changes - unreleased
 
   HADOOP-9081. Add TestWinUtils. (Chuan Liu, Ivan Mitic, Chris Nauroth, 
   and Bikas Saha via suresh)
+
+  HADOOP-9146. Fix sticky bit regression on branch-trunk-win.
+  (Chris Nauroth via suresh)

Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java?rev=1422288&r1=1422287&r2=1422288&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
(original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
Sat Dec 15 17:00:43 2012
@@ -36,6 +36,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.io.nativeio.NativeIO;
 import org.apache.hadoop.util.Progressable;
 import org.apache.hadoop.util.Shell;
 import org.apache.hadoop.util.StringUtils;
@@ -592,7 +593,23 @@ public class RawLocalFileSystem extends 
    * Use the command chmod to set permission.
    */
   @Override
-  public void setPermission(Path p, FsPermission permission) throws IOException {
-    FileUtil.setPermission(pathToFile(p), permission);
+  public void setPermission(Path p, FsPermission permission)
+    throws IOException {
+    if (NativeIO.isAvailable()) {
+      NativeIO.POSIX.chmod(pathToFile(p).getCanonicalPath(),
+                     permission.toShort());
+    } else {
+      execCommand(pathToFile(p), Shell.SET_PERMISSION_COMMAND,
+          String.format("%05o", permission.toShort()));
+    }
   }
+
+  private static String execCommand(File f, String... cmd) throws IOException {
+    String[] args = new String[cmd.length + 1];
+    System.arraycopy(cmd, 0, args, 0, cmd.length);
+    args[cmd.length] = FileUtil.makeShellPath(f, true);
+    String output = Shell.execCommand(args);
+    return output;
+  }
+
 }



Mime
View raw message