Hadoop Common
  1. Hadoop Common
  2. HADOOP-9502

chmod does not return error exit codes for some exceptions

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.0
    • Component/s: fs
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      When some dfs operations fail due to SnapshotAccessControlException, valid exit codes are not returned.

      E.g:

      -bash-4.1$  hadoop dfs -chmod -R 755 /user/foo/hdfs-snapshots/test0/.snapshot/s0
      chmod: changing permissions of 'hdfs://<namenode>:8020/user/foo/hdfs-snapshots/test0/.snapshot/s0':org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotAccessControlException: Modification on read-only snapshot is disallowed
      
      -bash-4.1$ echo $?
      0
      
      -bash-4.1$  hadoop dfs -chown -R hdfs:users /user/foo/hdfs-snapshots/test0/.snapshot/s0
      chown: changing ownership of 'hdfs://<namenode>:8020/user/foo/hdfs-snapshots/test0/.snapshot/s0':org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotAccessControlException: Modification on read-only snapshot is disallowed
      
      -bash-4.1$ echo $?
      0
      

      Similar problems exist for some other exceptions such as SafeModeException.

      1. c9502_20130424.patch
        3 kB
        Tsz Wo Nicholas Sze

        Issue Links

          Activity

          Ramya Sunil created issue -
          Ramya Sunil made changes -
          Field Original Value New Value
          Component/s datanode [ 12312927 ]
          Component/s namenode [ 12312926 ]
          Jing Zhao made changes -
          Assignee Tsz Wo (Nicholas), SZE [ szetszwo ]
          Hide
          Tsz Wo Nicholas Sze added a comment -

          I think it is a bug in trunk: FsShellPermissions does not return error code when there is an exception.

          Show
          Tsz Wo Nicholas Sze added a comment - I think it is a bug in trunk: FsShellPermissions does not return error code when there is an exception.
          Hide
          Tsz Wo Nicholas Sze added a comment -

          I have verified it. This is a general chmod problem in branch-1.

          Show
          Tsz Wo Nicholas Sze added a comment - I have verified it. This is a general chmod problem in branch-1.
          Tsz Wo Nicholas Sze made changes -
          Parent HDFS-2802 [ 12538675 ]
          Issue Type Sub-task [ 7 ] Bug [ 1 ]
          Tsz Wo Nicholas Sze made changes -
          Summary SnapshotAccessControlException does not return valid exit codes chmod does not return error exit codes for some exceptions
          Fix Version/s Snapshot (HDFS-2802) [ 12323386 ]
          Priority Major [ 3 ] Minor [ 4 ]
          Component/s hdfs-client [ 12312928 ]
          Component/s namenode [ 12312926 ]
          Component/s datanode [ 12312927 ]
          Tsz Wo Nicholas Sze made changes -
          Project Hadoop HDFS [ 12310942 ] Hadoop Common [ 12310240 ]
          Key HDFS-4736 HADOOP-9502
          Component/s fs [ 12310689 ]
          Component/s hdfs-client [ 12312928 ]
          Tsz Wo Nicholas Sze made changes -
          Description When some dfs operations fail due to SnapshotAccessControlException, valid exit codes are not returned.

          E.g:
          -bash-4.1$ hadoop dfs -chmod -R 755 /user/foo/hdfs-snapshots/test0/.snapshot/s0
          chmod: changing permissions of 'hdfs://&lt;namenode&gt;:8020/user/foo/hdfs-snapshots/test0/.snapshot/s0&#39;:org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotAccessControlException: Modification on read-only snapshot is disallowed

          -bash-4.1$ echo $?
          0

          -bash-4.1$ hadoop dfs -chown -R hdfs:users /user/foo/hdfs-snapshots/test0/.snapshot/s0
          chown: changing ownership of 'hdfs://&lt;namenode&gt;:8020/user/foo/hdfs-snapshots/test0/.snapshot/s0&#39;:org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotAccessControlException: Modification on read-only snapshot is disallowed

          -bash-4.1$ echo $?
          0

          When some dfs operations fail due to SnapshotAccessControlException, valid exit codes are not returned.

          E.g:
          {noformat}
          -bash-4.1$ hadoop dfs -chmod -R 755 /user/foo/hdfs-snapshots/test0/.snapshot/s0
          chmod: changing permissions of 'hdfs://&lt;namenode&gt;:8020/user/foo/hdfs-snapshots/test0/.snapshot/s0&#39;:org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotAccessControlException: Modification on read-only snapshot is disallowed

          -bash-4.1$ echo $?
          0

          -bash-4.1$ hadoop dfs -chown -R hdfs:users /user/foo/hdfs-snapshots/test0/.snapshot/s0
          chown: changing ownership of 'hdfs://&lt;namenode&gt;:8020/user/foo/hdfs-snapshots/test0/.snapshot/s0&#39;:org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotAccessControlException: Modification on read-only snapshot is disallowed

          -bash-4.1$ echo $?
          0
          {noformat}

          Similar problems exist for some other exceptions such as SafeModeException.
          Hide
          Tsz Wo Nicholas Sze added a comment -

          c9502_20130424.patch: fix FsShellPermissions

          Show
          Tsz Wo Nicholas Sze added a comment - c9502_20130424.patch: fix FsShellPermissions
          Tsz Wo Nicholas Sze made changes -
          Attachment c9502_20130424.patch [ 12580394 ]
          Hide
          Suresh Srinivas added a comment -

          +1 for the change.

          Show
          Suresh Srinivas added a comment - +1 for the change.
          Hide
          Tsz Wo Nicholas Sze added a comment -
               [exec] -1 overall.  
               [exec] 
               [exec]     +1 @author.  The patch does not contain any @author tags.
               [exec] 
               [exec]     -1 tests included.  The patch doesn't appear to include any new or modified tests.
               [exec]                         Please justify why no tests are needed for this patch.
               [exec] 
               [exec]     +1 javadoc.  The javadoc tool did not generate any warning messages.
               [exec] 
               [exec]     +1 javac.  The applied patch does not increase the total number of javac compiler warnings.
               [exec] 
               [exec]     -1 findbugs.  The patch appears to introduce 19 new Findbugs (version 1.3.9) warnings.
          

          The fingbugs warnings are not related.

          I tested the patch manually. It worked well.

          Show
          Tsz Wo Nicholas Sze added a comment - [exec] -1 overall. [exec] [exec] +1 @author. The patch does not contain any @author tags. [exec] [exec] -1 tests included. The patch doesn't appear to include any new or modified tests. [exec] Please justify why no tests are needed for this patch. [exec] [exec] +1 javadoc. The javadoc tool did not generate any warning messages. [exec] [exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings. [exec] [exec] -1 findbugs. The patch appears to introduce 19 new Findbugs (version 1.3.9) warnings. The fingbugs warnings are not related. I tested the patch manually. It worked well.
          Hide
          Tsz Wo Nicholas Sze added a comment -

          I have committed this.

          Show
          Tsz Wo Nicholas Sze added a comment - I have committed this.
          Tsz Wo Nicholas Sze made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Hadoop Flags Reviewed [ 10343 ]
          Fix Version/s 1.2.0 [ 12321659 ]
          Resolution Fixed [ 1 ]
          Tsz Wo Nicholas Sze made changes -
          Link This issue is related to HADOOP-9543 [ HADOOP-9543 ]
          Hide
          Matt Foley added a comment -

          Closed upon release of Hadoop 1.2.0.

          Show
          Matt Foley added a comment - Closed upon release of Hadoop 1.2.0.
          Matt Foley made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          23h 24m 1 Tsz Wo Nicholas Sze 24/Apr/13 23:39
          Resolved Resolved Closed Closed
          20d 6h 36m 1 Matt Foley 15/May/13 06:15

            People

            • Assignee:
              Tsz Wo Nicholas Sze
              Reporter:
              Ramya Sunil
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development