瀏覽代碼

commit 173f438ab9eef9df7d5f95d32cc1b723ea870628
Author: Jakob Homan <jhoman@yahoo-inc.com>
Date: Mon Dec 14 19:45:50 2009 -0800

HDFS:595 from
https://issues.apache.org/jira/secure/attachment/12427977/HDFS-595-Y20.patch

+++ b/YAHOO-CHANGES.txt
+ HDFS-595. umask settings in configuration may now use octal or
+ symbolic instead of decimal. Update HDFS tests as such. (jghoman)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1077075 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 年之前
父節點
當前提交
00ea06ff53

+ 2 - 2
src/test/org/apache/hadoop/hdfs/TestDFSPermission.java

@@ -153,8 +153,8 @@ public class TestDFSPermission extends TestCase {
   /* create a file/directory with the given umask and permission */
   private void create(OpType op, Path name, short umask, 
       FsPermission permission) throws IOException {
-    // set umask in configuration
-    conf.setInt(FsPermission.UMASK_LABEL, umask);
+    // set umask in configuration, converting to padded octal
+    conf.set(FsPermission.UMASK_LABEL, String.format("%1$03o", umask));
 
     // create the file/directory
     switch (op) {

+ 2 - 2
src/test/org/apache/hadoop/security/TestPermission.java

@@ -66,7 +66,7 @@ public class TestPermission extends TestCase {
   public void testCreate() throws Exception {
     Configuration conf = new Configuration();
     conf.setBoolean("dfs.permissions", true);
-    conf.setInt(FsPermission.UMASK_LABEL, 0);
+    conf.set(FsPermission.UMASK_LABEL, "000");
     MiniDFSCluster cluster = null;
     FileSystem fs = null;
 
@@ -94,7 +94,7 @@ public class TestPermission extends TestCase {
       checkPermission(fs, "/b1/b2", inheritPerm);
       checkPermission(fs, "/b1/b2/b3.txt", filePerm);
       
-      conf.setInt(FsPermission.UMASK_LABEL, 0022);
+      conf.set(FsPermission.UMASK_LABEL, "022");
       FsPermission permission = 
         FsPermission.createImmutable((short)0666);
       FileSystem.mkdirs(fs, new Path("/c1"), new FsPermission(permission));