Hadoop Common
  1. Hadoop Common
  2. HADOOP-7325

hadoop command - do not accept class names starting with a hyphen

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.22.0
    • Component/s: scripts
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      If this is committed I will look at patches for hdfs and mapred.

      When teaching a good portion of the students in every single class execute:

      $ hadoop -fs ls /
      

      The -fs is passed directly to the JVM and the JVM fails to start:

      $ ./bin/hadoop -fs ls /
      Unrecognized option: -fs
      Could not create the Java virtual machine.
      

      Which is confusing and typically requires explanation. The attached patch improves that behavior:

      $ ./bin/hadoop -fs ls /
      Error: No command named `-fs' was found. Perhaps you meant `hadoop fs'
      

      The only risk I can see is if someone is abusing the implementation of hadoop command doing something like so:

      $ ./bin/hadoop -Xmx1g  org.apache.hadoop.util.RunJar
      RunJar jarFile [mainClass] args...
      

      The hadoop command does not appear to advertise allowing JVM options before the classname.

      1. hadoop-illegal-class-name-0.patch
        0.7 kB
        Brock Noland
      2. hadoop-illegal-class-name-1.patch
        0.5 kB
        Brock Noland
      3. hadoop-illegal-class-name-2.patch
        0.6 kB
        Brock Noland

        Issue Links

          Activity

          Brock Noland created issue -
          Brock Noland made changes -
          Field Original Value New Value
          Attachment hadoop-illegal-class-name-0.patch [ 12480193 ]
          Todd Lipcon made changes -
          Assignee Brock Noland [ brocknoland ]
          Aaron T. Myers made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Brock Noland made changes -
          Attachment hadoop-illegal-class-name-1.patch [ 12481405 ]
          Brock Noland made changes -
          Attachment hadoop-illegal-class-name-2.patch [ 12481408 ]
          Todd Lipcon made changes -
          Hadoop Flags [Reviewed]
          Todd Lipcon made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Fix Version/s 0.22.0 [ 12314296 ]
          Resolution Fixed [ 1 ]
          Eli Collins made changes -
          Assignee Brock Noland [ brocknoland ] Eli Collins [ eli ]
          Eli Collins made changes -
          Assignee Eli Collins [ eli ] Brock Noland [ brocknoland ]
          Eli Collins made changes -
          Link This issue incorporates HADOOP-7491 [ HADOOP-7491 ]

            People

            • Assignee:
              Brock Noland
              Reporter:
              Brock Noland
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development