hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rang...@apache.org
Subject svn commit: r642304 - in /hadoop/core/branches/branch-0.16: CHANGES.txt src/java/org/apache/hadoop/fs/FsShell.java src/java/org/apache/hadoop/fs/FsShellPermissions.java src/test/org/apache/hadoop/dfs/TestDFSShell.java
Date Fri, 28 Mar 2008 17:22:54 GMT
Author: rangadi
Date: Fri Mar 28 10:22:51 2008
New Revision: 642304

URL: http://svn.apache.org/viewvc?rev=642304&view=rev
Log:
HADOOP-3098. Allow more characters in user and group names while
using -chown and -chgrp commands. (rangadi)

Modified:
    hadoop/core/branches/branch-0.16/CHANGES.txt
    hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/fs/FsShell.java
    hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/fs/FsShellPermissions.java
    hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/dfs/TestDFSShell.java

Modified: hadoop/core/branches/branch-0.16/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/CHANGES.txt?rev=642304&r1=642303&r2=642304&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.16/CHANGES.txt Fri Mar 28 10:22:51 2008
@@ -83,6 +83,9 @@
 
     HADOOP-2911. Make the information printed by the HOD allocate and
     info commands less verbose and clearer. (Vinod Kumar via nigel)
+
+    HADOOP-3098. Allow more characters in user and group names while
+    using -chown and -chgrp commands. (rangadi)
     
   BUG FIXES
 

Modified: hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/fs/FsShell.java?rev=642304&r1=642303&r2=642304&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/fs/FsShell.java (original)
+++ hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/fs/FsShell.java Fri Mar 28
10:22:51 2008
@@ -1272,8 +1272,14 @@
       "\t-R\tmodifies the files recursively. This is the only option\n" +
       "\t\tcurrently supported.\n\n" +
       "\t\tIf only owner or group is specified then only owner or\n" +
-      "\t\tgroup is modified. The owner and group names can only\n" + 
-      "\t\tcontain digits and alphabet. These names are case sensitive.\n";
+      "\t\tgroup is modified.\n\n" +
+      "\t\tThe owner and group names may only cosists of digits, alphabet,\n"+
+      "\t\tand any of '-_.@/' i.e. [-_.@/a-zA-Z0-9]. The names are case\n" +
+      "\t\tsensitive.\n\n" +
+      "\t\tWARNING: Avoid using '.' to separate user name and group though\n" +
+      "\t\tLinux allows it. If user names have dots in them and you are\n" +
+      "\t\tusing local file system, you might see surprising results since\n" +
+      "\t\tshell command 'chown' is used for local files.\n";
     
     String chgrp = FsShellPermissions.CHGRP_USAGE + "\n" +
       "\t\tThis is equivalent to -chown ... :GROUP ...\n";

Modified: hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/fs/FsShellPermissions.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/fs/FsShellPermissions.java?rev=642304&r1=642303&r2=642304&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/fs/FsShellPermissions.java
(original)
+++ hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/fs/FsShellPermissions.java
Fri Mar 28 10:22:51 2008
@@ -190,11 +190,13 @@
 
   /*========== chown ==========*/
   
-  ///allows only alpha-numberic names for owner group
+  static private String allowedChars = "[-_./@a-zA-Z0-9]";
+  ///allows only "allowedChars" above in names for owner and group
   static private Pattern chownPattern = 
-         Pattern.compile("^\\s*(\\p{Alnum}+)?([:.](\\p{Alnum}*))?\\s*$");
+         Pattern.compile("^\\s*(" + allowedChars + "+)?" +
+                          "([:](" + allowedChars + "*))?\\s*$");
   static private Pattern chgrpPattern = 
-         Pattern.compile("^\\s*(\\p{Alnum}+)\\s*$");
+         Pattern.compile("^\\s*(" + allowedChars + "+)\\s*$");
   
   static String CHOWN_USAGE = "-chown [-R] [OWNER][:[GROUP]] PATH...";
   static String CHGRP_USAGE = "-chgrp [-R] GROUP PATH...";  

Modified: hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/dfs/TestDFSShell.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/dfs/TestDFSShell.java?rev=642304&r1=642303&r2=642304&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/dfs/TestDFSShell.java (original)
+++ hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/dfs/TestDFSShell.java Fri
Mar 28 10:22:51 2008
@@ -385,7 +385,7 @@
   public void testFilePermissions() throws IOException {
     Configuration conf = new Configuration();
     
-    //test chnmod on local fs
+    //test chmod on local fs
     FileSystem fs = FileSystem.getLocal(conf);
     testChmod(conf, fs, 
               (new File(TEST_ROOT_DIR, "chmodTest")).getAbsolutePath());
@@ -427,6 +427,20 @@
 
     runCmd(shell, "-chown", "-R", "hadoop:toys", "unknownFile", "/");
     confirmOwner("hadoop", "toys", fs, root, parent, path);
+    
+    // Test different characters in names
+
+    runCmd(shell, "-chown", "hdfs.user", file);
+    confirmOwner("hdfs.user", null, fs, path);
+    
+    runCmd(shell, "-chown", "_Hdfs.User-10:_hadoop.users--", file);
+    confirmOwner("_Hdfs.User-10", "_hadoop.users--", fs, path);
+    
+    runCmd(shell, "-chown", "hdfs/hadoop-core@apache.org:asf-projects", file);
+    confirmOwner("hdfs/hadoop-core@apache.org", "asf-projects", fs, path);
+    
+    runCmd(shell, "-chgrp", "hadoop-core@apache.org/100", file);
+    confirmOwner(null, "hadoop-core@apache.org/100", fs, path);
     
     cluster.shutdown();
   }



Mime
View raw message