Closed jacktose closed 6 years ago
Try…
brew --version
git -C $(linuxbrew --repo) fetch --depth=1 origin 1.6.9
brew --version
No joy.
$ brew --version
Homebrew >=1.4.0 (shallow or no git repository)
Homebrew/homebrew-core (git revision 40a1db; last commit 2018-06-20)
$ git -C $(linuxbrew --repo) fetch --depth=1 origin 1.6.9
-bash: linuxbrew: command not found
fatal: cannot change to 'fetch': No such file or directory
$ git -C $(brew --repo) fetch --depth=1 origin 1.6.9
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From github.com:Linuxbrew/brew
* tag 1.6.9 -> FETCH_HEAD
$ brew --version
Homebrew >=1.4.0 (shallow or no git repository)
Homebrew/homebrew-core (git revision 554e7; last commit 2018-06-20)
Try…
brew --version
cd $(brew --repo)
git log --oneline -n1
git describe --tags
git pull --ff-only --depth=1
brew --version
~ $ brew --version
Homebrew >=1.4.0 (shallow or no git repository)
Homebrew/homebrew-core (git revision 554e7; last commit 2018-06-20)
~ $ cd $(brew --repo)
.linuxbrew $ git log --oneline -n1
3ba4c2ed9 (grafted, HEAD -> stable, tag: 1.6.9, origin/master, origin/HEAD) Merge tag Homebrew/1.6.9 into Linuxbrew/master
.linuxbrew $ git describe --tags
1.6.9
.linuxbrew $ git pull --ff-only
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> stable
.linuxbrew $ brew --version
Homebrew >=1.4.0 (shallow or no git repository)
Homebrew/homebrew-core (git revision 554e7; last commit 2018-06-20)
FYI:
.linuxbrew $ git branch
master
* stable
I don't see a stable
branch here. What's that about?
The stable
branch is a local branch pointing to the most recent tag, 1.6.9 in this case.
Please report…
which -a git
git --version
/usr/bin/git --version
brew --version
HOMEBREW_NO_ENV_FILTERING=1 brew --version
$ which -a git
/usr/local/bin/git
/bin/git
/usr/bin/git
$ git --version
git version 2.17.1
$ /usr/local/bin/git --version
git version 2.17.1
$ /bin/git --version
git version 1.8.3.1
$ /usr/bin/git --version
git version 1.8.3.1
$ brew --version
Homebrew >=1.4.0 (shallow or no git repository)
Homebrew/homebrew-core (git revision 554e7; last commit 2018-06-20)
$ HOMEBREW_NO_ENV_FILTERING=1 brew --version
Homebrew 1.6.9
Homebrew/homebrew-core (git revision 554e7; last commit 2018-06-20)
Ohhhh. Just found this:
# test-bot does environment filtering itself
if [[ -z "$HOMEBREW_NO_ENV_FILTERING" && "$1" != "test-bot" ]]
then
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
Is it intended that *brew doesn't respect the regular system path (by default)?
I'm on a machine (as you can guess from my brew doctor
) with a really non-standard path setup. I don't know the intention of the above lines, but it seems that brew is just shooting itself in the foot in this case.
Filtering the environment by default (specifically PATH
) is a new-ish feature (a few months old). It helps in many cases where users have weird broken executables in their PATH. It's more reliable and reproducible to use system executables and brewed executables, and avoid the user's PATH. There's a few bugs though. Two in particular are that by default it uses /usr/bin/git
rather than brewed git
and /usr/bin/curl
rather than brewed curl
, which causes issues like this when those system executables are too old. When the host executables are too old, it should use the brewed executables. That's not happening currently though, which is a bug. If you're interesting in submitting a patch to fix this issue, I can point you in the right direction.
I'd be happy to take a crack at it. Is it not as simple as adding the brew path to the front of the path?
(I'll just export HOMEBREW_NO_ENV_FILTERING=1
on this machine for now. Thanks!)
Is it not as simple as adding the brew path to the front of the path?
It would be, and somewhere in the history of pull requests, there's a PR opened by me that was closed without being merged. We try to keep Linuxbrew's behaviour similar to Homebrew's behaviour, and Homebrew does not do that.
Homebrew and Linuxbrew do have a configuration option HOMEBREW_FORCE_BREWED_CURL=1, but there's no corresponding option HOMEBREW_FORCE_BREWED_GIT
. Would you be up for implementing that option?
There's also the auto-detected variable HOMEBREW_SYSTEM_CURL_TOO_OLD
, which enables HOMEBREW_FORCE_BREWED_CURL=1
automatically. If there were the corresponding feature HOMEBREW_SYSTEM_GIT_TOO_OLD
, it would resolve this bug.
It would be, and somewhere in the history of pull requests, there's a PR opened by me that was closed without being merged. We try to keep Linuxbrew's behaviour similar to Homebrew's behaviour, and Homebrew does not do that. Aha!
Yeah, sounds like both of those could be pretty easily copied from the curl versions. I'll give it a shot.
Homebrew/brew/pull/4377 merged, implementing HOMEBREW_FORCE_BREWED_GIT
& HOMEBREW_SYSTEM_GIT_TOO_OLD
in mostly the same way as the _CURL
equivalents.
It occurs to me that that change doesn't actually fix my original issue, where I had a good git in the path, but not a brewed git. I suppose that won't be fixed, for whatever the reason that “there's a PR opened by me that was closed without being merged.”
But I can still work around it by exporting HOMEBREW_NO_ENV_FILTERING=1
.
Or maybe HOMEBREW_GIT=$(which git)
?
Library/Homebrew/shims/scm/git
appears to respect the environment variable HOMEBREW_GIT
.
https://github.com/Linuxbrew/brew/blob/3ba4c2ed9b0587040949a4a9a95b576f520bae84/Library/Homebrew/shims/scm/git#L88
I believe this script is used by brew install
, but it may not be used by brew --version
and brew update
. A reasonable fix, at least for Linux, would be to modify brew
to prefer Library/Homebrew/shims/scm/git
over /usr/bin/git
on Linux for all commands, not only brew install
.
brew
command and reproduced the problem with multiple formulae? not about formulaebrew update
and can still reproduce the problem?brew doctor
, fixed all issues and can still reproduce the problem? Fixed everything I have access to. Don't think it's related.brew config
andbrew doctor
and included their output with your issue?To help us debug your issue please explain:
What you were trying to do (and why) Update linuxbrew to latest version.
What happened (include command output) Brew reports
Homebrew >=1.4.0 (shallow or no git repository)
What you expected to happen
Homebrew = 1.6.9
maybe? That's current.Step-by-step reproduction instructions (by running
brew
commands)brew config
andbrew doctor
output: