From 077eee8f86d8b59fd25899d9b6adc2f95250635e Mon Sep 17 00:00:00 2001 From: Greg NISBET Date: Sat, 4 Nov 2023 16:10:21 -0700 Subject: [PATCH] [shell] Override CDPATH in brew script. The CDPATH environment variable can affect the behavior of `cd`, and `cd` takes the `-P`, `-L` and `-e` flags. (I didn't know about `-e` until looking at the source) Make quietcd more robust by setting the CDPATH to ''. I tested this change by running the following commands from a nonstandard directory, which caused some of tcsh's and perl's dependencies to be recompiled. $ [path to brew] install tcsh $ [path to brew] install perl Here's a link to the source code of `cd` in a mirror of the bash repo. https://github.com/bminor/bash/blob/ec8113b9861375e4e17b3307372569d429dec814/builtins/cd.def#L267 --- bin/brew | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/brew b/bin/brew index e842609c5d..34b2e5b3ea 100755 --- a/bin/brew +++ b/bin/brew @@ -27,7 +27,7 @@ then fi quiet_cd() { - cd "$@" &>/dev/null || return + CDPATH='' cd -- "$@" &>/dev/null || return } symlink_target_directory() {