You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@storm.apache.org by "Jungtaek Lim (JIRA)" <ji...@apache.org> on 2017/07/03 15:44:00 UTC

[jira] [Updated] (STORM-2486) bin/storm launcher script can be broken if CDPATH is exported from environment

     [ https://issues.apache.org/jira/browse/STORM-2486?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jungtaek Lim updated STORM-2486:
--------------------------------
    Fix Version/s: 1.2.0

> bin/storm launcher script can be broken if CDPATH is exported from environment
> ------------------------------------------------------------------------------
>
>                 Key: STORM-2486
>                 URL: https://issues.apache.org/jira/browse/STORM-2486
>             Project: Apache Storm
>          Issue Type: Bug
>          Components: storm-submit-tools
>            Reporter: Erik Weathers
>            Assignee: Erik Weathers
>            Priority: Minor
>             Fix For: 2.0.0, 0.10.3, 1.0.4, 1.1.1, 1.2.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> In the {{bin/storm}} script there is logic that attempts to determine the fullpath of the {{bin}} directory, and it relies on using {{cd}} and {{pwd}} like so:
> {code}
> STORM_BIN_DIR=`dirname ${PRG}`
> export STORM_BASE_DIR=`cd ${STORM_BIN_DIR}/..;pwd`
> {code}
> This is problematic if your environment has an exported {{CDPATH}} variable which contains a matching entry, because bash's built-in {{cd}} command prints out the directory upon successfully matching a {{CDPATH}} entry.  And then the {{pwd}} command prints the same directory again.  So the behavior results in the {{STORM_BASE_DIR}} variable containing duplicate paths with a newline in between.  This results in a broken classpath in the Storm processes, which looks something like this:
> {code}
> ...:/base/apache-storm-2.0.0-SNAPSHOT/lib/storm-rename-hack-2.0.0-SNAPSHOT.jar:/base/apache-storm-2.0.0-SNAPSHOT^J/base/apache-storm-2.0.0-SNAPSHOT/conf:/base/apache-storm-2.0.0-SNAPSHOT/storm-local/supervisor/stormdist/foo-1-1480491213/stormjar.jar
> {code}
> Or with the {{:}} chars replaced with newlines for ease of readability:
> {code}
> ...
> /base/apache-storm-2.0.0-SNAPSHOT/lib/storm-rename-hack-2.0.0-SNAPSHOT.jar
> /base/apache-storm-2.0.0-SNAPSHOT^J/base/apache-storm-2.0.0-SNAPSHOT/conf
> /base/apache-storm-2.0.0-SNAPSHOT/storm-local/supervisor/stormdist/foo-1-1480491213/stormjar.jar
> {code}
> Note that the classpath entry with {{/conf}} as a suffix is munged, with a {{^J}} character in between duplicate copies of the base path.
> The solution is easy:  at the beginning of the {{bin/storm}} script we should {{unset CDPATH}}.
> FYI, this "CDPATH + bash script" problem is covered in this blog entry:
> * https://bosker.wordpress.com/2012/02/12/bash-scripters-beware-of-the-cdpath/



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