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

Slight niggle with combined arm/intel environments #16329

Closed
1 task done
keeely opened this issue Dec 13, 2023 · 3 comments
Closed
1 task done

Slight niggle with combined arm/intel environments #16329

keeely opened this issue Dec 13, 2023 · 3 comments
Labels
features New features outdated PR was locked due to age

Comments

@keeely
Copy link

keeely commented Dec 13, 2023

Verification

Provide a detailed description of the proposed feature

I'd like to add both intel and arm Homebrew paths to my environment, because I've got a mix of packages from each brew architecture.

What I'd like to do, is add a couple of commands to ~/.zshrc

eval $(/usr/local/bin/brew shellenv)
eval $(/opt/homebrew/bin/brew shellenv)

If I have only one of these, e.g.

eval $(/usr/local/bin/brew shellenv)

Then repeated sourcing of .zshrc results in no change, because the shellenv command is smart enough to understand if the necessary things are already in the path, and emits nothing if they are.

Repeated execution of the two commands together, however, results in infinitely growing PATH, MANPATH and INFOPATH variables because the code in shellenv doesn't understand the contribution from the 'other' architecture.

I can, of course conditionally execute these commands in scripts, but since there is already some logic in shellenv to detect repetitive execution I wondered if it could be extended to become smarter.

What is the motivation for the feature?

Less per-install custom scripting around the management of Homebrew environments.

How will the feature be relevant to at least 90% of Homebrew users?

I think arm/intel mixes are somewhat common, as github don't supply runners that can build arm64 binaries.

What alternatives to the feature have been considered?

I can script around the problem, obviously.

@keeely keeely added the features New features label Dec 13, 2023
@MikeMcQuaid
Copy link
Member

Repeated execution of the two commands together, however, results in infinitely growing PATH, MANPATH and INFOPATH variables because the code in shellenv doesn't understand the contribution from the 'other' architecture.

This is somewhat intentional: brew shellenv is checking that the its installation is first in the PATH and running the other brew shellenv breaks that logic. As a result, yeh, you're better to either use custom logic here or not use brew shellenv for one of the environments. There's no real way otherwise for it to be able to tell what you want it to do.

Sorry!

@MikeMcQuaid MikeMcQuaid closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2023
@keeely
Copy link
Author

keeely commented Dec 13, 2023

I guess another approach might be (for arm only) detect the intel, and add both in a single call. Assume if someone installed both architectures, they want to execute both prioritising the native one, which I think is not unreasonable.

@MikeMcQuaid
Copy link
Member

@keeely I don't think it's safe to assume that people want it either way hence I think letting users do what they think is best is appropriate.

@github-actions github-actions bot added the outdated PR was locked due to age label Jan 13, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
features New features outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

2 participants