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:
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.
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:
and replace the above with the following:
bin=`cd "$bin" &> /dev/null; pwd`