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

Enis Soztutar commented on HADOOP-9660:
---------------------------------------

I see your argument for the user to know the shell, but the convention for -D 
parameter passing to override conf has already been established and well 
documented since the early days of hadoop (see 
http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/CommandsManual.html).
 I am trying to keep the same command line arguments passing to not create 
further confusion for the user. 

bq. Attempting to infer could have unintended side effects, such as making it 
impossible to pass just "-D" as an argument.
Right now, you cannot pass -D as an argument to your class anyway, given that 
class implements Tool, and uses ToolRunner. -D parsing in GenericOptionsParser 
right now, just ignores -Dkey if there is not a '=' in it. The only thing that 
this patch changes is that if you are using -Dkey some_other_parameter, an 
incorrect usage which is silently ignored, then this will cause it to be parsed 
as -Dkey=some_other_parameter. I don't see this as breaking compatibility. 
                
> [WINDOWS] Powershell / cmd parses -Dkey=value from command line as [-Dkey, 
> value] which breaks GenericsOptionParser
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-9660
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9660
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: scripts, util
>            Reporter: Enis Soztutar
>            Assignee: Enis Soztutar
>             Fix For: 3.0.0, 2.1.0-beta
>
>         Attachments: hadoop-9660-branch1_v1.patch, 
> hadoop-9660-branch2_v1.patch
>
>
> When parsing parameters to a class implementing Tool, and using ToolRunner, 
> we can pass 
> {code}
> bin/hadoop <tool_class> -Dkey=value 
> {code}
> However, powershell parses the '=' sign itself, and sends it to  java as 
> ["-Dkey", "value"] which breaks GenericOptionsParser. 
> Using "-Dkey=value" or '-Dkey=value' does not fix the problem. The only 
> workaround seems to trick PS by using: 
> '"-Dkey=value"' (single + double quote)
> In cmd, "-Dkey=value" works, but not '"-Dkey=value"'. 
> http://stackoverflow.com/questions/4940375/how-do-i-pass-an-equal-sign-when-calling-a-batch-script-in-powershell

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to