hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lane Schwartz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-6851) Fix '$bin' path duplication in setup scripts
Date Fri, 13 Jul 2012 19:36:36 GMT

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

Lane Schwartz commented on HADOOP-6851:
---------------------------------------

This problem occurs when CDPATH is set and includes "." (the present working directory). It
is unsafe to assume that cd will not print to standard output.

The bash documentation states:

{quote}
If a non-empty directory name from CDPATH is used, or if ‘-’ is the first argument, and
the directory change is successful, the absolute pathname of the new working directory is
written to the standard output. 
{quote}

Steps to recreate:

1. export CDPATH=.
2. Run any hadoop script that contains the offending bin=`cd "$bin"; pwd` line

In this case, because CDPATH includes "." and the current value of $bin is "." an invocation
of "cd" will cause the current absolute path to be printed to standard output. I have verified
this problem occurs under these circumstances using bash 4.1.2(1) on Scientific Linux 6.2.

The safest fix is to find all instances of the following:

{code}
bin=`cd "$bin"; pwd`
{code}

and replace the above with the following:

{code}
bin=`cd "$bin" &> /dev/null; pwd`
{code}
                
> Fix '$bin' path duplication in setup scripts
> --------------------------------------------
>
>                 Key: HADOOP-6851
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6851
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Nicolas Spiegelberg
>            Priority: Trivial
>         Attachments: HADOOP-6851-0.22.patch
>
>
> I have my bash environment setup to echo absolute pathnames when a relative one is specified
in 'cd'. This caused problems with all the Hadoop bash scripts because the script accidentally
sets the $bin variable twice in this setup. (e.g. would set $bin="/path/bin/hadoop\n/path/bin/hadoop").
> This jira is for common scripts.  I filed a separate jira for HDFS scripts, which share
the same pattern.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message