hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arpit Agarwal (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-14976) Allow overriding HADOOP_SHELL_EXECNAME
Date Thu, 26 Oct 2017 18:53:00 GMT

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

Arpit Agarwal commented on HADOOP-14976:
----------------------------------------

bq. So we could just change the top to remove the calculation off of MYNAME, running the risk
that someone who copies and pastes the code without understanding it may make some big mistakes.
Thank you for suggesting that alternative. What do you think is the right thing to do - make
that change and formalize the fact that these environment variables are not meant to be renamed;
or leave it as it is to avoid copy-paste bugs like you described?

> Allow overriding HADOOP_SHELL_EXECNAME
> --------------------------------------
>
>                 Key: HADOOP-14976
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14976
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Arpit Agarwal
>
> Some Hadoop shell scripts infer their own name using this bit of shell magic:
> {code}
>  18     MYNAME="${BASH_SOURCE-$0}"
>  19     HADOOP_SHELL_EXECNAME="${MYNAME##*/}"
> {code}
> e.g. see the [hdfs|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs#L18]
script.
> The inferred shell script name is later passed to _hadoop-functions.sh_ which uses it
to construct the names of some environment variables. E.g. when invoking _hdfs datanode_,
the options variable name is inferred as follows:
> {code}
> # HDFS + DATANODE + OPTS -> HDFS_DATANODE_OPTS
> {code}
> This works well if the calling script name is standard {{hdfs}} or {{yarn}}. If a distribution
renames the script to something like foo.bar, , then the variable names will be inferred as
{{FOO.BAR_DATANODE_OPTS}}. This is not a valid bash variable name.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message