You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/08/01 08:25:00 UTC

[jira] [Work logged] (HADOOP-18327) Fix eval expression in hadoop-functions.sh

     [ https://issues.apache.org/jira/browse/HADOOP-18327?focusedWorklogId=796809&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-796809 ]

ASF GitHub Bot logged work on HADOOP-18327:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Aug/22 08:24
            Start Date: 01/Aug/22 08:24
    Worklog Time Spent: 10m 
      Work Description: iwasakims commented on PR #4536:
URL: https://github.com/apache/hadoop/pull/4536#issuecomment-1200881485

   @ashutoshcipher If your suggestion is to add support spaces enclosed in single quote (`'`) like `-XX:OnOutOfMemoryError='kill -9 %p'`, you should add the statement to [documentation](https://github.com/apache/hadoop/blob/2680f17eb49d7d6e117156108f9a013b38141999/hadoop-common-project/hadoop-common/src/site/markdown/UnixShellGuide.md) and [tests](https://github.com/apache/hadoop/tree/2680f17eb49d7d6e117156108f9a013b38141999/hadoop-common-project/hadoop-common/src/test/scripts) showing the spec.




Issue Time Tracking
-------------------

    Worklog Id:     (was: 796809)
    Time Spent: 2h  (was: 1h 50m)

> Fix eval expression in hadoop-functions.sh
> ------------------------------------------
>
>                 Key: HADOOP-18327
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18327
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 3.3.3
>            Reporter: groot
>            Assignee: groot
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> Need to fix the eval expression.
> 1. 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.
> 2. We can replace single quote with escape-char and a double quote.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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