hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r1471749 - in /hadoop/common/branches/branch-1.2: ./ CHANGES.txt src/core/org/apache/hadoop/fs/FsShell.java src/core/org/apache/hadoop/fs/FsShellPermissions.java
Date Wed, 24 Apr 2013 22:38:31 GMT
Author: szetszwo
Date: Wed Apr 24 22:38:31 2013
New Revision: 1471749

URL: http://svn.apache.org/r1471749
Log:
svn merge -c 1471747 from branch-1 for HADOOP-9502. chmod/chown do not return error exit codes
for some exceptions.

Modified:
    hadoop/common/branches/branch-1.2/   (props changed)
    hadoop/common/branches/branch-1.2/CHANGES.txt   (contents, props changed)
    hadoop/common/branches/branch-1.2/src/core/org/apache/hadoop/fs/FsShell.java
    hadoop/common/branches/branch-1.2/src/core/org/apache/hadoop/fs/FsShellPermissions.java

Propchange: hadoop/common/branches/branch-1.2/
------------------------------------------------------------------------------
  Merged /hadoop/common/branches/branch-1:r1471747

Modified: hadoop/common/branches/branch-1.2/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.2/CHANGES.txt?rev=1471749&r1=1471748&r2=1471749&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.2/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1.2/CHANGES.txt Wed Apr 24 22:38:31 2013
@@ -591,6 +591,9 @@ Release 1.2.0 - 2013.04.16
     HADOOP-9458. Fix RPC.getProxy to ensure it uses retries for
     getProtocolVersion too. (szetszwo via acmurthy)
 
+    HADOOP-9502. chmod/chown do not return error exit codes for some exceptions.
+    (szetszwo)
+
 Release 1.1.2 - 2013.01.30
 
   INCOMPATIBLE CHANGES

Propchange: hadoop/common/branches/branch-1.2/CHANGES.txt
------------------------------------------------------------------------------
  Merged /hadoop/common/branches/branch-1/CHANGES.txt:r1471747

Modified: hadoop/common/branches/branch-1.2/src/core/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.2/src/core/org/apache/hadoop/fs/FsShell.java?rev=1471749&r1=1471748&r2=1471749&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.2/src/core/org/apache/hadoop/fs/FsShell.java (original)
+++ hadoop/common/branches/branch-1.2/src/core/org/apache/hadoop/fs/FsShell.java Wed Apr 24
22:38:31 2013
@@ -1235,8 +1235,9 @@ public class FsShell extends Configured 
         errors++;
       }
       for(Path path : paths) {
+        FileStatus file = null;
         try {
-          FileStatus file = srcFs.getFileStatus(path);
+          file = srcFs.getFileStatus(path);
           if (file == null) {
             System.err.println(handler.getName() + 
                                ": could not get status for '" + path + "'");
@@ -1248,8 +1249,15 @@ public class FsShell extends Configured 
           String msg = (e.getMessage() != null ? e.getLocalizedMessage() :
             (e.getCause().getMessage() != null ? 
                 e.getCause().getLocalizedMessage() : "null"));
-          System.err.println(handler.getName() + ": could not get status for '"
-                                        + path + "': " + msg.split("\n")[0]);
+          msg = msg.split("\n")[0];
+          if (file == null) {
+            //getFileStatus fails
+            msg = ": could not get status for '" + path + "': " + msg;
+          } else {
+            //other failure
+            msg = ": failed on '" + path + "': " + msg;
+          }
+          System.err.println(handler.getName() + msg);
           errors++;
         }
       }

Modified: hadoop/common/branches/branch-1.2/src/core/org/apache/hadoop/fs/FsShellPermissions.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.2/src/core/org/apache/hadoop/fs/FsShellPermissions.java?rev=1471749&r1=1471748&r2=1471749&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.2/src/core/org/apache/hadoop/fs/FsShellPermissions.java
(original)
+++ hadoop/common/branches/branch-1.2/src/core/org/apache/hadoop/fs/FsShellPermissions.java
Wed Apr 24 22:38:31 2013
@@ -22,8 +22,8 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.apache.hadoop.fs.FsShell.CmdHandler;
-import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.fs.permission.ChmodParser;
+import org.apache.hadoop.fs.permission.FsPermission;
 
 
 /**
@@ -65,13 +65,7 @@ class FsShellPermissions {
       int newperms = pp.applyNewPermission(file);
 
       if (file.getPermission().toShort() != newperms) {
-        try {
-          srcFs.setPermission(file.getPath(), 
-                                new FsPermission((short)newperms));
-        } catch (IOException e) {
-          System.err.println(getName() + ": changing permissions of '" + 
-                             file.getPath() + "':" + e.getMessage().split("\n")[0]);
-        }
+        srcFs.setPermission(file.getPath(), new FsPermission((short)newperms));
       }
     }
   }
@@ -124,13 +118,7 @@ class FsShellPermissions {
                         null : group;
 
       if (newOwner != null || newGroup != null) {
-        try {
-          srcFs.setOwner(file.getPath(), newOwner, newGroup);
-        } catch (IOException e) {
-          System.err.println(getName() + ": changing ownership of '" + 
-                             file.getPath() + "':" + e.getMessage().split("\n")[0]);
-
-        }
+        srcFs.setOwner(file.getPath(), newOwner, newGroup);
       }
     }
   }



Mime
View raw message