Brew test fails in Docker Ubuntu (Stdenv supports switching compilers)

I have some Docker containers I build and noticed that somewhere between Homebrew 2.2.11 and 2.2.14 my tests (brew tests) broke.

Here is the full log (GitHub Actions) of the last build that passed the tests and here is the full failing log.

The following error shows. I get the same result when I build those same docker images locally and tried searching the internet, but couldn’t find similar issues. I have also already installed the dependencies for brew and the tests (see sources here) and the system is ready to brew according to brew doctor.

Does anyone have any idea what is going on here and how I can track this issue down further? I’ve checked the change-log between 2.2.11 and 2.2.14 and saw a bunch of changes regarding ENV and PATH, but honestly have no clue to point it down.

  1) Stdenv supports switching compilers
     Failure/Error: subject.clang

     FrozenError:
       can't modify frozen Hash
     Shared Example Group: EnvActivation called from ./test/ENV_spec.rb:175
     # ./extend/ENV/std.rb:118:in `clang'
     # ./test/ENV_spec.rb:11:in `block (2 levels) in <top (required)>'
     # ./test/spec_helper.rb:185:in `block (2 levels) in <top (required)>'
     # ./vendor/bundle/ruby/2.6.0/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:124:in `block in run'
     # ./vendor/bundle/ruby/2.6.0/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:110:in `loop'
     # ./vendor/bundle/ruby/2.6.0/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:110:in `run'
     # ./vendor/bundle/ruby/2.6.0/gems/rspec-retry-0.6.2/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry'
     # ./vendor/bundle/ruby/2.6.0/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:37:in `block (2 levels) in setup'
     # ./vendor/bundle/ruby/2.6.0/gems/rspec-wait-0.0.9/lib/rspec/wait.rb:46:in `block (2 levels) in <top (required)>'

Additional info

+ brew --env
export CC="gcc"
export CXX="g\+\+"
export OBJC="gcc"
export OBJCXX="g\+\+"
export HOMEBREW_CC="gcc"
export HOMEBREW_CXX="g\+\+"
export MAKEFLAGS="-j2"
export CMAKE_PREFIX_PATH="/home/linuxbrew/.linuxbrew"
export HOMEBREW_GIT="git"
export PATH="/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super:/usr/bin:/bin:/usr/sbin:/sbin"


HOMEBREW_VERSION: 2.2.14
ORIGIN: https://github.com/Homebrew/brew
HEAD: e2bc0fa6879ce4c74ea2d8f8c654c9812f776b43
Last commit: 3 days ago
Core tap ORIGIN: https://github.com/Homebrew/linuxbrew-core
Core tap HEAD: d5a54e142851a928491b98359e5fd06bff40176e
Core tap last commit: 14 hours ago
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_MAKE_JOBS: 2
CPU: dual-core 64-bit skylake
Homebrew Ruby: 2.6.3 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/bin/ruby
Clang: N/A
Git: 2.7.4 => /usr/bin/git
Curl: 7.47.0 => /usr/bin/curl
Kernel: Linux 5.0.0-1035-azure x86_64 GNU/Linux
OS: Unknown
Host glibc: 2.23
/usr/bin/gcc: 5.4.0
glibc: N/A
gcc: N/A
xorg: N/A



+ brew doctor
Your system is ready to brew.

I actually was able to narrow this down to one commit, by going through the versions first and then through the commits between the two versions. The failure appeared between 2.2.12 and 2.2.13 and is actually caused by commit Homebrew/brew@c5c161a, originating from a PR Homebrew/brew#7334.

My test results:

2.2.12 working
757cc24 working
bf66c88 working
8900e85 working
6ea6db9 working
32744e1 working
9b8762f working
c5c161a failing
2.2.13 failing

Using the following commands in a Docker container.

apt-get update \
  && apt-get install -y --no-install-recommends \
  apt-utils \
  ca-certificates \
  uuid-runtime \
  build-essential \
  curl \
  file \
  git ruby-dev \
  patch \
  zlib1g-dev \
  liblzma-dev \
&& apt-get clean \
  && rm -rf /var/lib/apt/lists/* \
  && apt-get update \
  && apt-get install -y --no-install-recommends locales \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/* \
  && localedef -i en_US -c -f UTF-8 \
  -A /usr/share/locale/locale.alias en_US.UTF-8 \
  && export LANG='en_US.utf8' \
  && apt-get install \
  && export homebrew_user='linuxbrew' \
  && useradd -m -s /bin/bash "${homebrew_user}" \
  && echo "${homebrew_user} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
  && su - "${homebrew_user}"

git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew \
&& cd ~/.linuxbrew/Homebrew \
&& git checkout 9b8762f \
&& mkdir ~/.linuxbrew/bin \
&& ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin \
&& eval $(~/.linuxbrew/bin/brew shellenv) \
&& HOMEBREW_NO_AUTO_UPDATE=1 brew --version \
&& HOMEBREW_NO_AUTO_UPDATE=1 brew install hello \
&& hello \
&& HOMEBREW_NO_AUTO_UPDATE=1 brew tests

Edit: I’ve created Homebrew/brew#7482 for this.

Fixed in https://github.com/Homebrew/brew/pull/7483