Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.36k stars 9.73k forks source link

Strange output when testing with HOMEBREW_NO_ENV_FILTERING #3596

Closed chdiza closed 6 years ago

chdiza commented 6 years ago

Config:

HOMEBREW_VERSION: 1.4.1-11-g583b61f
ORIGIN: https://github.com/Homebrew/brew
HEAD: 583b61fd324643f15bb8017a6b652afbbbfe7cbc
Last commit: 6 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: c08c42ee603b8cc8c903d21cba30abfa950e6b3f
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/hb
HOMEBREW_BUILD_FROM_SOURCE: 1
HOMEBREW_CACHE: /stuff/brache
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_LOGS: /Users/chdiza/Library/Homebrew
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_EMOJI: 1
HOMEBREW_NO_GITHUB_API: 1
HOMEBREW_REPOSITORY: /usr/local/hb
HOMEBREW_TEMP: /Users/chdiza/.tmp/tmpdir
HOMEBREW_VERBOSE: 1
CPU: quad-core 64-bit ivybridge
Homebrew Ruby: 2.3.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 9.0 build 900
Git: 2.14.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/chdiza/bin/ruby => /opt/slangs/rb/bin/ruby
Java: N/A
macOS: 10.13.2-x86_64
Xcode: 9.2
CLT: 9.2.0.0.1.1510905681
X11: N/A

Doctor says "ready to brew"

Sometimes I test stuff out with HOMEBREW_NO_ENV_FILTERING=1. That's not typically set, but I've been using it to get a feel for how my custom taps' building might be different now that the ENV filtering is enabled for everyone.

I've discovered that using that variable results in some weird output, even when I'm not doing anything fancy. I have a non-brewed, non-system ruby in my $PATH. E.g., if I do:

HOMEBREW_NO_ENV_FILTERING=1 brew ls

then I see the following:

Ignoring curses-1.2.4 because its extensions are not built.  Try: gem pristine curses --version 1.2.4

and then I see the normal brew ls output.

I do of course have the curses gem installed with my non-brewed, non-system ruby. But I find this output confusing and mysterious. There's nothing wrong with that gem (its extensions ARE built).

Anybody have any ideas? It's hard to employ *NO_ENV_FILTERING for testing purposes when this keeps appearing. It makes me think that maybe "no ENV filtering" is really "with some ENV filtering".

ilovezfs commented 6 years ago

@chdiza Maybe git bisect will help you find out why it's happening.

chdiza commented 6 years ago

Bisection done:

6b9ca5dbf5b625f1da93b82f5752b37ee0c61600 is the first bad commit
commit 6b9ca5dbf5b625f1da93b82f5752b37ee0c61600
Author: Mike McQuaid <mike@mikemcquaid.com>
Date:   Fri Dec 8 16:33:33 2017 +0000

    Remove some unset/checked environment checks

    These will be redundant once environment filtering is on by default
    in #3529.

My hunch is that the removal in this commit of the GEM_HOME and GEM_PATH unsettings are the problem.

MikeMcQuaid commented 6 years ago

@chdiza Sounds about right. Nice work on the spelunking @chdiza, I'll a look.

MikeMcQuaid commented 6 years ago

Tried hard to reproduce this and couldn't, I'm afraid. I installed that gem and tried this with the system ruby first in my PATH and with the patch-differing-only rbenv one flipped (and vice-versa) and couldn't get this warning. This may be an rvm or setting GEM_* problem or a call inside Homebrew to ruby that should be a call to $HOMEBREW_RUBY (if you can figure this out: I'll make a PR to fix it).

It makes me think that maybe "no ENV filtering" is really "with some ENV filtering".

So, it's basically the opposite: "no ENV filtering" used to be "some ENV filtering" but it isn't any more. You have GEM_* stuff set so 💥 because we're no longer unsetting those variables.

Sorry but due to the above: closing. Thanks for a great report as usual, though, @chdiza.