Hadoop Common
  1. Hadoop Common
  2. HADOOP-6143

FS shell commands returns incorrect exit code when error occurs

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: fs
    • Labels:
      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

      1. HADOOP-6143.patch
        10 kB
        Ravi Phulari
      2. HADOOP-6143-1.patch
        9 kB
        Ravi Phulari

        Issue Links

          Activity

            People

            • Assignee:
              Ravi Phulari
              Reporter:
              Ravi Phulari
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Development