You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Tsz Wo (Nicholas), SZE (JIRA)" <ji...@apache.org> on 2008/04/18 19:50:24 UTC

[jira] Created: (HADOOP-3281) bin/hadoop script should check class name before running java

bin/hadoop script should check class name before running java
-------------------------------------------------------------

                 Key: HADOOP-3281
                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
             Project: Hadoop Core
          Issue Type: Bug
          Components: scripts
            Reporter: Tsz Wo (Nicholas), SZE


When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
{noformat}
bash-3.2$ ./bin/hadoop -version
java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
bash-3.2$ ./bin/hadoop -help   
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
...
{noformat}
The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12593572#action_12593572 ] 

Doug Cutting commented on HADOOP-3281:
--------------------------------------

> We should check whether the parameter is a valid class name before passing it to java.

I agree, but I don't see a way to do that in the bin/hadoop script.

In HADOOP-435 we discussed moving all the 'if [$COMMAND = ...]' logic into a Java class, so that bin/hadoop might always invoke something like org.apache.hadoop.util.ToolRunner, which contains the 'if ((command.equals(...)))' logic.  This is another good reason to do that, since, once you're in Java, it's easy to detect if a command names a class or not, and generate a nice error message if it does not.

So I think the best fix for this is to (at long last) move the command dispatch from bin/hadoop into a Java class.

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>             Fix For: 0.18.0
>
>         Attachments: 3281.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Edward J. Yoon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edward J. Yoon updated HADOOP-3281:
-----------------------------------

    Fix Version/s: 0.18.0
           Status: Patch Available  (was: Open)

Submitting to TRUNK.

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>             Fix For: 0.18.0
>
>         Attachments: 3281.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Tsz Wo (Nicholas), SZE (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12593586#action_12593586 ] 

Tsz Wo (Nicholas), SZE commented on HADOOP-3281:
------------------------------------------------

Class name is a QualifiedIdentifier defined in
http://java.sun.com/docs/books/jls/third_edition/html/syntax.html
(see also http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.8)
Could we use a regular expression to check it?  For simplicity, we could ignore special cases like java keywords.

> So I think the best fix for this is to (at long last) move the command dispatch from bin/hadoop into a Java class.

I agree.  This is easier.

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>             Fix For: 0.18.0
>
>         Attachments: 3281.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Edward J. Yoon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12594529#action_12594529 ] 

Edward J. Yoon commented on HADOOP-3281:
----------------------------------------

Thank you. BTW, How does this "$HADOOP_NAMENODE_OPTS" work? 
I can't find the related source code with it.

{code}
if [ "$COMMAND" = "namenode" ] ; then
  CLASS='org.apache.hadoop.dfs.NameNode'
  HADOOP_OPTS="$HADOOP_OPTS $HADOOP_NAMENODE_OPTS"
{code}

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>             Fix For: 0.18.0
>
>         Attachments: 3281.patch, 3281_v01.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Edward J. Yoon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edward J. Yoon updated HADOOP-3281:
-----------------------------------

    Status: Open  (was: Patch Available)

>> So I think the best fix for this is to (at long last) move the command dispatch from bin/hadoop into a Java class.
>> Then, something like "./bin/hadoop org.apache.hadoop.dfs.NNBench" won't work anymore. We have to check for class names. 

Ooops. Sorry, i was overlooked a detail.

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>             Fix For: 0.18.0
>
>         Attachments: 3281.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12593664#action_12593664 ] 

Hadoop QA commented on HADOOP-3281:
-----------------------------------

-1 overall.  Here are the results of testing the latest attachment 
http://issues.apache.org/jira/secure/attachment/12381244/3281.patch
against trunk revision 645773.

    @author +1.  The patch does not contain any @author tags.

    tests included -1.  The patch doesn't appear to include any new or modified tests.
                        Please justify why no tests are needed for this patch.

    javadoc +1.  The javadoc tool did not generate any warning messages.

    javac +1.  The applied patch does not generate any new javac compiler warnings.

    release audit +1.  The applied patch does not generate any new release audit warnings.

    findbugs +1.  The patch does not introduce any new Findbugs warnings.

    core tests +1.  The patch passed core unit tests.

    contrib tests +1.  The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2359/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2359/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2359/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2359/console

This message is automatically generated.

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>             Fix For: 0.18.0
>
>         Attachments: 3281.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12593818#action_12593818 ] 

Doug Cutting commented on HADOOP-3281:
--------------------------------------

Ideally there should be no per-command information in bin/hadoop.  When one adds or alters a command, one should only have to edit one file.  So the OPTS stuff should move into Java too, as should all the help strings.


> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>             Fix For: 0.18.0
>
>         Attachments: 3281.patch, 3281_v01.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Tsz Wo (Nicholas), SZE (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12593590#action_12593590 ] 

Tsz Wo (Nicholas), SZE commented on HADOOP-3281:
------------------------------------------------

Edward, valid class names are disallowed in your patch.  Then, something like "./bin/hadoop org.apache.hadoop.dfs.NNBench" won't work anymore.  We have to check for class names.

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>             Fix For: 0.18.0
>
>         Attachments: 3281.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Edward J. Yoon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12593702#action_12593702 ] 

Edward J. Yoon commented on HADOOP-3281:
----------------------------------------

Hmm, Should vmArgs moved to java code, too?

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>             Fix For: 0.18.0
>
>         Attachments: 3281.patch, 3281_v01.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Mukund Madhugiri (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mukund Madhugiri updated HADOOP-3281:
-------------------------------------

    Fix Version/s:     (was: 0.18.0)

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>         Attachments: 3281.patch, 3281_v01.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Edward J. Yoon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edward J. Yoon reassigned HADOOP-3281:
--------------------------------------

    Assignee: Edward J. Yoon

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Edward J. Yoon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edward J. Yoon updated HADOOP-3281:
-----------------------------------

    Attachment: 3281.patch

I added a "Unknown Command" message instead of direct java execution as describe below.

{code}
$ bin/hadoop -version
Unknown Command : Type 'hadoop' without any parameters to see usage.

$ bin/hadoop asdf
Unknown Command : Type 'hadoop' without any parameters to see usage.

{code}

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>         Attachments: 3281.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HADOOP-3281) bin/hadoop script should check class name before running java

Posted by "Edward J. Yoon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edward J. Yoon updated HADOOP-3281:
-----------------------------------

    Attachment: 3281_v01.patch

{code}
[root@udanax hadoop]# bin/hadoop
Usage: hadoop [--config confdir] COMMAND
where COMMAND is one of:
  namenode -format     format the DFS filesystem
...

[root@udanax hadoop]# bin/hadoop org.apache.hadoop.Tester arg1 arg2
org.apache.hadoop.Tester: command/class not found
[root@udanax hadoop]# bin/hadoop tester
tester: command/class not found
[root@udanax hadoop]# bin/hadoop org.apache.hadoop.dfs.NNBenchs
org.apache.hadoop.dfs.NNBenchs: command/class not found
[root@udanax hadoop]# bin/hadoop org.apache.hadoop.dfs.NNBench
NameNode Benchmark 0.4
08/05/02 11:05:11 INFO dfs.NNBench: Test Inputs: 
08/05/02 11:05:11 INFO dfs.NNBench:            Test Operation: none
08/05/02 11:05:11 INFO dfs.NNBench:                Start time: 2008-05-02 11:07:11,219
...

[root@udanax hadoop]# bin/hadoop dfs -ls /
Found 6 items
1    212752      2008-05-02 10:52  -rw-r--r--  root  supergroup  /CHANGES.txt
...
{code}

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>             Fix For: 0.18.0
>
>         Attachments: 3281.patch, 3281_v01.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads, the parameter will be considered as a class name and the script will pass it to java.  For examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.