Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-6143

FS shell commands returns incorrect exit code when error occurs

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Incomplete
    • None
    • None
    • fs
    • None

    Description

      HDFS documentation ( http://hadoop.apache.org/core/docs/current/hdfs_shell.html#du ) mentions that

      Exit Code:
      
      Returns 0 on success and -1 on error. 
      

      Current Fs shell behavior is buggy with this agreement.

      statepick-lm:Hadoop rphulari$ bin/hadoop fs -ls foo
      ls: Cannot access foo: No such file or directory.
      statepick-lm:Hadoop rphulari$ echo $?
      255
      statepick-lm:Hadoop rphulari$ bin/hadoop fs -lsr foo
      lsr: Cannot access foo: No such file or directory.
      statepick-lm:Hadoop rphulari$ echo $?
      255
      statepick-lm:Hadoop rphulari$ bin/hadoop fs -du foo
      du: Cannot access foo: No such file or directory.
      statepick-lm:Hadoop rphulari$ echo $?
      255
      statepick-lm:Hadoop rphulari$ bin/hadoop fs -dus foo
      dus: Cannot access foo: No such file or directory.
      statepick-lm:Hadoop rphulari$ echo $?
      255
      statepick-lm:Hadoop rphulari$ bin/hadoop fs -cp foo f2
      cp: File does not exist: foo
      statepick-lm:Hadoop rphulari$ echo $?
      255
      statepick-lm:Hadoop rphulari$ bin/hadoop fs -copyToLocal foo f2
      copyToLocal: null
      statepick-lm:Hadoop rphulari$ echo $?
      255
      statepick-lm:Hadoop rphulari$ bin/hadoop fs -copyFromLocal foo f2
      copyFromLocal: File foo does not exist.
      statepick-lm:Hadoop rphulari$ echo $?
      255
      

      In all above cases exit code on error should be -1

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            raviphulari Ravi Phulari Assign to me
            raviphulari Ravi Phulari
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment