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

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.22.0
    • scripts
    • None
    • 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.

      Attachments

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

        Issue Links

          Activity

            People

              brocknoland Brock Noland
              brocknoland Brock Noland
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: