hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-15585) Fix spaces in HADOOP_OPTS arguments
Date Thu, 05 Jul 2018 22:45:00 GMT

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

ASF GitHub Bot commented on HADOOP-15585:
-----------------------------------------

GitHub user bschell opened a pull request:

    https://github.com/apache/hadoop/pull/400

    HADOOP-15585. Fix passing options via $HADOOP_OPTS

    Prior to this change, if HADOOP_OPTS contains any arguments that include a space, the
command is not parsed correctly. The only alternative appears to be to use 'eval'. Switching
to use 'eval' *instead of* 'exec' also works, but it results in an intermediate bash process
being left alive throughout the entire lifetime of the Java process being started. Using 'exec'
prefixed by 'eval' as has been done in this commit gets the best of both worlds, in that options
with spaces are parsed correctly, and you don't end up with an intermediate bash process as
the parent of the Java process.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/bschell/hadoop bschelle/shellfix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/hadoop/pull/400.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #400
    
----
commit b22d7658ad2fc18e20cdb0e7e1e4a875bf41dc3e
Author: Scheller <bschelle@...>
Date:   2018-06-29T21:14:04Z

    Fix passing options via $HADOOP_OPTS
    
    Prior to this change, if HADOOP_OPTS contains any arguments that include a space, the
command is not parsed correctly. The only alternative appears to be to use 'eval'. Switching
to use 'eval' *instead of* 'exec' also works, but it results in an intermediate bash process
being left alive throughout the entire lifetime of the Java process being started. Using 'exec'
prefixed by 'eval' as has been done in this commit gets the best of both worlds, in that options
with spaces are parsed correctly, and you don't end up with an intermediate bash process as
the parent of the Java process.

----


> Fix spaces in HADOOP_OPTS arguments
> -----------------------------------
>
>                 Key: HADOOP-15585
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15585
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: scripts
>    Affects Versions: 3.0.3
>            Reporter: Brandon Scheller
>            Priority: Major
>              Labels: bash, shell-script
>
> Prefix exec by eval in Hadoop bin scripts
> Prior to this change, if HADOOP_OPTS contains any arguments that include a
> space, the command is not parsed correctly. For example, if
> HADOOP_OPTS="... -XX:OnOutOfMemoryError=\"kill -9 %p\" ...", the bin/hadoop
> script will fail with the error "Unrecognized option: -9". No amount of clever
> escaping of the quotes or spaces in the "kill -9 %p" command will fix this.
> The only alternative appears to be to use 'eval'. Switching to use 'eval'
> *instead of* 'exec' also works, but it results in an intermediate bash process
> being left alive throughout the entire lifetime of the Java proces being
> started. Using 'exec' prefixed by 'eval' as has been done in this commit gets
> the best of both worlds, in that options with spaces are parsed correctly, and
> you don't end up with an intermediate bash process as the parent of the Java
> process.
> This is the exact approach that has been taken with Tomcat as well. See:
> http://tomcat.10.x6.nabble.com/Using-eval-vs-exec-in-shell-scripts-td2193116.html
> https://github.com/apache/tomcat/commit/3445dc3dba7b15f2fff27faef77003215f62e49a
> https://github.com/apache/tomcat/commit/83c0aea60f331eb632dcea8e9919d234903e06d1



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

---------------------------------------------------------------------
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