[ 
https://issues.apache.org/jira/browse/HDDS-583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16640368#comment-16640368
 ] 

Arpit Agarwal commented on HDDS-583:
------------------------------------

Thanks for reporting this [~nmaheshwari]. This is a nice find.

I think it's a good idea to print the help when the options are unrecognized, 
but the return code should be non-zero.

> SCM returns zero as the return code, even when invalid options are passed
> -------------------------------------------------------------------------
>
>                 Key: HDDS-583
>                 URL: https://issues.apache.org/jira/browse/HDDS-583
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>            Reporter: Namit Maheshwari
>            Assignee: Namit Maheshwari
>            Priority: Major
>         Attachments: HDDS-583.001.patch
>
>
> While doing testing for HDDS-564, found that SCM returns zero as the return 
> code, even when invalid options are passed. In StorageContainerManager.java, 
> please see below code 
> {code:java}
> private static StartupOption parseArguments(String[] args) {
>   int argsLen = (args == null) ? 0 : args.length;
>   StartupOption startOpt = StartupOption.HELP;
> {code}
> Here, startOpt is initialized to HELP, so by default even if wrong options 
> are passed, parseArguments method returns the value to HELP. This causes the 
> exit code to be 0. 
> Ideally, startOpt should be set to null, which will enable it to return non 
> zero exit code, if the options are invalid.
> {code:java}
> StartupOption startOpt = null{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to