[
https://issues.apache.org/jira/browse/HDFS-1281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13413989#comment-13413989
]
Lane Schwartz commented on HDFS-1281:
-------------------------------------
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: HDFS-1281
> URL: https://issues.apache.org/jira/browse/HDFS-1281
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: scripts
> Affects Versions: 0.20-append, 0.21.0, 0.22.0
> Reporter: Nicolas Spiegelberg
> Priority: Minor
> Attachments: HDFS-1281.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 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