Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't allow installing formulae from paths without HOMEBREW_DEVELOPER #18371

Open
3 tasks done
TheFanatr opened this issue Sep 22, 2024 · 2 comments
Open
3 tasks done
Labels
bug Reproducible Homebrew/brew bug help wanted We want help addressing this

Comments

@TheFanatr
Copy link

TheFanatr commented Sep 22, 2024

brew doctor output

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  [email protected]
  pyyaml

Warning: You have the following deprecated, official taps tapped:
  Homebrew/homebrew-cask-versions
Untap them with `brew untap`.

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  uutils-coreutils

Verification

  • My "brew doctor output" above says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update twice and am still able to reproduce my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

HOMEBREW_VERSION: 4.3.23
ORIGIN: https://github.com/Homebrew/brew
HEAD: 42c11a4dedf352229271593de831161071603c66
Last commit: 5 days ago
Core tap JSON: 21 Sep 22:52 UTC
Core cask tap JSON: 21 Sep 22:52 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 3.3.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/bin/ruby
CPU: dodeca-core 64-bit arm_blizzard_avalanche
Clang: 16.0.0 build 1600
Git: 2.46.1 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.1-arm64
CLT: 16.0.0.0.1.1723780521
Xcode: 16.1 => /Applications/Xcode-16.1.0-Beta.app/Contents/Developer
Rosetta 2: false

What were you trying to do (and why)?

I wrote a formula for Slang here. When debugging the formula locally I noticed two things: if I asked for brew info slang when installed, I would get the information for s-lang; and importantly that if I install from a local ruby file like brew install --formula --head ./slang.rb, then after successfully running the install, it would say it will try to do brew cleanup slang, but this would fail by apparently trying to run cleanup on s-lang. When the formula is installed remote with brew install --formula --head thefanatr/slang/slang, this does not happen.

What happened (include all command output)?

brew install --head --formula ../homebrew-slang/slang.rb

Error

==> Installing slang --HEAD
==> cmake -S. -Bbuild -GNinja -DHOMEBREW_ALLOW_FETCHCONTENT=ON -DSLANG_INCLUDE_TESTS=OFF
==> cmake --build build --parallel 12
==> cmake --install build --strip --prefix /opt/homebrew/Cellar/slang/HEAD-6e18236
🍺  /opt/homebrew/Cellar/slang/HEAD-6e18236: 142 files, 36.2MB, built in 43 seconds
==> Running `brew cleanup slang`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Error: /opt/homebrew/Cellar/s-lang/HEAD-6e18236 is not a directory
==> Auto-updating Homebrew...
Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with
HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Fetching dependencies for slang: libffi, catch2 and mimalloc
==> Fetching libffi
==> Downloading https://ghcr.io/v2/homebrew/core/libffi/manifests/3.4.6
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/2d373c9b8d06ce1d9634d08a4be79711fd482169e98bc830509aa28f3f07926d--libffi-3.4.6.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:3c98bcb95fbcf46bdc04e0bdc87c5253a8f965edc8da1f1fe1213a9e438abc7e
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/801694bba7f61c15e96432171d8a764c364a34e13317b5b844ec476c8a791996--libffi--3.4.6.arm64_sequoia.bottle.tar.gz
==> Fetching catch2
==> Downloading https://ghcr.io/v2/homebrew/core/catch2/manifests/3.7.1
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/237805171c4583863ea3bb8c6886a971249af5846da5a1ea2591df65522f14fc--catch2-3.7.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/catch2/blobs/sha256:b63c2bff461b22383d01e8edc201f50e7ecbd0590d8d0d8b3d1c481ca3c297f5
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/4d4b8c1e7530a45a2c82056a2e7011b70b77d8a911ec16f3f78aafdc40e3908f--catch2--3.7.1.arm64_sequoia.bottle.tar.gz
==> Fetching mimalloc
==> Downloading https://ghcr.io/v2/homebrew/core/mimalloc/manifests/2.1.7
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/a3640aee8b2009686d953179c1832c4a6fc881ac9bfbd1a25b16f2f5b7f05d09--mimalloc-2.1.7.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/mimalloc/blobs/sha256:f789cf5d97f314c7d49563eee1e694fba7ce430983e4b661cd5d43312759df34
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/d9e46761b0c2ce90e693a26a8c7996a6f37c3e474db0c19ae2fe8e9c8cec6f88--mimalloc--2.1.7.arm64_sequoia.bottle.tar.gz
==> Fetching slang
==> Cloning https://github.com/MikePopoloski/slang.git
Updating /Users/me/Library/Caches/Homebrew/slang--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at 6e182363 [slang][parser] Fix timeless constraint expression parsing (#1128)
==> Installing dependencies for slang: libffi, catch2 and mimalloc
==> Installing slang dependency: libffi
==> Downloading https://ghcr.io/v2/homebrew/core/libffi/manifests/3.4.6
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/2d373c9b8d06ce1d9634d08a4be79711fd482169e98bc830509aa28f3f07926d--libffi-3.4.6.bottle_manifest.json
==> Pouring libffi--3.4.6.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libffi/3.4.6: 18 files, 764.5KB
==> Installing slang dependency: catch2
==> Downloading https://ghcr.io/v2/homebrew/core/catch2/manifests/3.7.1
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/237805171c4583863ea3bb8c6886a971249af5846da5a1ea2591df65522f14fc--catch2-3.7.1.bottle_manifest.json
==> Pouring catch2--3.7.1.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/catch2/3.7.1: 230 files, 2.7MB
==> Installing slang dependency: mimalloc
==> Downloading https://ghcr.io/v2/homebrew/core/mimalloc/manifests/2.1.7
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/a3640aee8b2009686d953179c1832c4a6fc881ac9bfbd1a25b16f2f5b7f05d09--mimalloc-2.1.7.bottle_manifest.json
==> Pouring mimalloc--2.1.7.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/mimalloc/2.1.7: 29 files, 603.0KB
==> Installing slang --HEAD
==> cmake -S. -Bbuild -GNinja -DHOMEBREW_ALLOW_FETCHCONTENT=ON -DSLANG_INCLUDE_TESTS=OFF
==> cmake --build build --parallel 12
==> cmake --install build --strip --prefix /opt/homebrew/Cellar/slang/HEAD-6e18236
🍺  /opt/homebrew/Cellar/slang/HEAD-6e18236: 142 files, 36.2MB, built in 43 seconds
==> Running `brew cleanup slang`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Error: /opt/homebrew/Cellar/s-lang/HEAD-6e18236 is not a directory

brew cleanup slang

Warning: Skipping s-lang: most recent version 2.3.3 not installed

but

brew install --head thefanatr/slang/slang

No Error

==> Installing thefanatr/slang/slang --HEAD
==> cmake -S. -Bbuild -GNinja -DHOMEBREW_ALLOW_FETCHCONTENT=ON -DSLANG_INCLUDE_TESTS=OFF
==> cmake --build build --parallel 12
==> cmake --install build --strip --prefix /opt/homebrew/Cellar/slang/HEAD-6e18236
🍺  /opt/homebrew/Cellar/slang/HEAD-6e18236: 142 files, 36.2MB, built in 40 seconds
==> Running `brew cleanup slang`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Tapping thefanatr/slang
Cloning into '/opt/homebrew/Library/Taps/thefanatr/homebrew-slang'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 6 (delta 0), reused 3 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (6/6), done.
Tapped 1 formula (14 files, 9.3KB).
==> Fetching dependencies for thefanatr/slang/slang: libffi, catch2 and mimalloc
==> Fetching libffi
==> Downloading https://ghcr.io/v2/homebrew/core/libffi/manifests/3.4.6
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/2d373c9b8d06ce1d9634d08a4be79711fd482169e98bc830509aa28f3f07926d--libffi-3.4.6.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:3c98bcb95fbcf46bdc04e0bdc87c5253a8f965edc8da1f1fe1213a9e438abc7e
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/801694bba7f61c15e96432171d8a764c364a34e13317b5b844ec476c8a791996--libffi--3.4.6.arm64_sequoia.bottle.tar.gz
==> Fetching catch2
==> Downloading https://ghcr.io/v2/homebrew/core/catch2/manifests/3.7.1
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/237805171c4583863ea3bb8c6886a971249af5846da5a1ea2591df65522f14fc--catch2-3.7.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/catch2/blobs/sha256:b63c2bff461b22383d01e8edc201f50e7ecbd0590d8d0d8b3d1c481ca3c297f5
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/4d4b8c1e7530a45a2c82056a2e7011b70b77d8a911ec16f3f78aafdc40e3908f--catch2--3.7.1.arm64_sequoia.bottle.tar.gz
==> Fetching mimalloc
==> Downloading https://ghcr.io/v2/homebrew/core/mimalloc/manifests/2.1.7
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/a3640aee8b2009686d953179c1832c4a6fc881ac9bfbd1a25b16f2f5b7f05d09--mimalloc-2.1.7.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/mimalloc/blobs/sha256:f789cf5d97f314c7d49563eee1e694fba7ce430983e4b661cd5d43312759df34
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/d9e46761b0c2ce90e693a26a8c7996a6f37c3e474db0c19ae2fe8e9c8cec6f88--mimalloc--2.1.7.arm64_sequoia.bottle.tar.gz
==> Fetching thefanatr/slang/slang
==> Cloning https://github.com/MikePopoloski/slang.git
Updating /Users/me/Library/Caches/Homebrew/slang--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at 6e182363 [slang][parser] Fix timeless constraint expression parsing (#1128)
==> Installing slang from thefanatr/slang
==> Installing dependencies for thefanatr/slang/slang: libffi, catch2 and mimalloc
==> Installing thefanatr/slang/slang dependency: libffi
==> Downloading https://ghcr.io/v2/homebrew/core/libffi/manifests/3.4.6
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/2d373c9b8d06ce1d9634d08a4be79711fd482169e98bc830509aa28f3f07926d--libffi-3.4.6.bottle_manifest.json
==> Pouring libffi--3.4.6.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libffi/3.4.6: 18 files, 764.5KB
==> Installing thefanatr/slang/slang dependency: catch2
==> Downloading https://ghcr.io/v2/homebrew/core/catch2/manifests/3.7.1
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/237805171c4583863ea3bb8c6886a971249af5846da5a1ea2591df65522f14fc--catch2-3.7.1.bottle_manifest.json
==> Pouring catch2--3.7.1.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/catch2/3.7.1: 230 files, 2.7MB
==> Installing thefanatr/slang/slang dependency: mimalloc
==> Downloading https://ghcr.io/v2/homebrew/core/mimalloc/manifests/2.1.7
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/a3640aee8b2009686d953179c1832c4a6fc881ac9bfbd1a25b16f2f5b7f05d09--mimalloc-2.1.7.bottle_manifest.json
==> Pouring mimalloc--2.1.7.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/mimalloc/2.1.7: 29 files, 603.0KB
==> Installing thefanatr/slang/slang --HEAD
==> cmake -S. -Bbuild -GNinja -DHOMEBREW_ALLOW_FETCHCONTENT=ON -DSLANG_INCLUDE_TESTS=OFF
==> cmake --build build --parallel 12
==> cmake --install build --strip --prefix /opt/homebrew/Cellar/slang/HEAD-6e18236
🍺  /opt/homebrew/Cellar/slang/HEAD-6e18236: 142 files, 36.2MB, built in 40 seconds
==> Running `brew cleanup slang`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

brew cleanup slang

Warning: Skipping s-lang: most recent version 2.3.3 not installed

What did you expect to happen?

The no error version for the local formula case.

Step-by-step reproduction instructions (by running brew commands)

1. `curl -O https://raw.githubusercontent.com/TheFanatr/homebrew-slang/3931c5347b1686767b7195c16027cf25b1c37600/slang.rb`
2. `brew install --formula --head ./slang.rb`


- `brew uninstall slang`


1. `brew install --formula --head thefanatr/slang/slang`
@TheFanatr TheFanatr added the bug Reproducible Homebrew/brew bug label Sep 22, 2024
@carlocab
Copy link
Member

Yea, installing formulae from paths is buggy and shouldn't be used. We should probably remove the ability to do that at some point.

To avoid this, put slang.rb in a tap (e.g. one created with brew tap-new) and then do brew install thefanatr/your-tap-name/slang. Note that a tap doesn't need to be a Git repo. It would be sufficient to do something like:

FORMULA_DIR="$(brew --repository)/Library/Taps/thefanatr/homebrew-your-tap-name/Formula/"
mkdir -p "$FORMULA_DIR"
mv ../homebrew-slang/slang.rb "$FORMULA_DIR"
brew install thefanatr/your-tap-name/slang

@MikeMcQuaid MikeMcQuaid added the help wanted We want help addressing this label Sep 23, 2024
@MikeMcQuaid
Copy link
Member

Yea, installing formulae from paths is buggy and shouldn't be used. We should probably remove the ability to do that at some point.

Agreed 👍🏻. Rescoping this issue to that.

@MikeMcQuaid MikeMcQuaid changed the title Automatic Cleanup on Install of Local Formula File Aliases Name to Names From Taps Don't allow installing formulae from paths without HOMEBREW_DEVELOPER Sep 23, 2024
carlocab added a commit that referenced this issue Sep 23, 2024
…EVELOPER

If `HOMEBREW_DEVELOPER` is not set, then let's make
`HOMEBREW_FORBID_PACKAGES_FROM_PATHS` default to true.

I used a custom implementation here because we don't currently support
setting defaults for booleans. (See calls to `define_method` below.)

Closes #18371.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/brew bug help wanted We want help addressing this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants