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

Key: HADOOP-7325
URL: https://issues.apache.org/jira/browse/HADOOP-7325
Project: Hadoop Common
Issue Type: Improvement
Components: scripts
Reporter: Brock Noland
Priority: Minor
Attachments: hadoop-illegal-class-name-0.patch

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:

{code}
$ hadoop -fs ls /
{code}

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

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

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

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

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

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

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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Search Discussions

  • Dave Shine at May 24, 2011 at 12:19 pm
    I'm not sure if this is the intended behavior, but it sounds like this JIRA will change it. I found out the hard way that running

    hadoop jar myMapReduceJob.jar

    runs the M/R job with the current hadoop configuration. However running

    hadoop -jar myMarReduceJob.jar

    runs the M/R job with a different configuration, something that appears to be stand alone mode. It drove me nuts for a few days before I realized that sometimes I was typing the dash and sometimes not.

    Dave



    -----Original Message-----
    From: Brock Noland (JIRA)
    Sent: Monday, May 23, 2011 9:23 PM
    To: common-dev@hadoop.apache.org
    Subject: [jira] [Created] (HADOOP-7325) hadoop command - do not accept class names starting with a hyphen

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

    Key: HADOOP-7325
    URL: https://issues.apache.org/jira/browse/HADOOP-7325
    Project: Hadoop Common
    Issue Type: Improvement
    Components: scripts
    Reporter: Brock Noland
    Priority: Minor
    Attachments: hadoop-illegal-class-name-0.patch

    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:

    {code}
    $ hadoop -fs ls /
    {code}

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

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

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

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

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

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

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

    --
    This message is automatically generated by JIRA.
    For more information on JIRA, see: http://www.atlassian.com/software/jira

    The information contained in this email message is considered confidential and proprietary to the sender and is intended solely for review and use by the named recipient. Any unauthorized review, use or distribution is strictly prohibited. If you have received this message in error, please advise the sender by reply email and delete the message.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommon-dev @
categorieshadoop
postedMay 24, '11 at 1:23a
activeMay 24, '11 at 12:19p
posts2
users2
websitehadoop.apache.org...
irc#hadoop

2 users in discussion

Dave Shine: 1 post Brock Noland (JIRA): 1 post

People

Translate

site design / logo © 2022 Grokbase