GitHub user Anvil opened a pull request:

    https://github.com/apache/zookeeper/pull/40

    Redirecting cd stdout to dev/null in expansions to avoid CDPATH noise

    CDPATH is an environment variable which alters `cd` behaviour. It's usage 
is defined by POSIX and when `cd` parameter is found in CDPATH, the `cd` 
command prints on its stdout the matching directory the shell is entering.
    
    For instance : 
    ```
    $ export CDPATH=/
    $ cd /usr
    $ cd usr/bin
    /usr/bin
    ```
    This can become annoying when one is using cd in backquotes or $() 
expansion such as `ZOOBINDIR="$(cd "${ZOOBIN}"; pwd)"`.
    
    ```
    $ bash -x usr/bin/zkCli.sh
    + ZOOBIN=usr/bin/zkCli.sh
    ++ dirname usr/bin/zkCli.sh
    + ZOOBIN=usr/bin
    ++ cd usr/bin
    ++ pwd
    + ZOOBINDIR='/usr/bin
    /usr/bin'
    + '[' -e usr/bin/../libexec/zkEnv.sh ']'
    + . '/usr/bin
    /usr/bin/../libexec/zkEnv.sh'
    usr/bin/zkCli.sh: line 34: /usr/bin
    /usr/bin/../libexec/zkEnv.sh: No such file or directory
    + '' -Dzookeeper.log.dir= -Dzookeeper.root.logger= -cp '' 
org.apache.zookeeper.ZooKeeperMain
    usr/bin/zkCli.sh: line 39:  : command not found
    zsh: exit 127   bash -x usr/bin/zkCli.sh
    ```
    
    As you can see, under some circumstances, when CDPATH is set, zk*.sh 
scripts will define wrong values of ZOOBINDIR. I think it's a bug worth fixing.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Anvil/zookeeper trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/zookeeper/pull/40.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #40
    
----
commit 9527df7ef4ff0f7990a67eedf7e39fb4d0506668
Author: Damien Nadé <[email protected]>
Date:   2015-08-13T07:11:20Z

    Redirecting cd stdout to dev/null in expansions to avoid CDPATH noise

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to