Skip to content

cmd/update: use short option in update.sh #20368

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

Merged
merged 1 commit into from
Aug 4, 2025

Conversation

chirsz-ever
Copy link
Contributor

Following McQuaid's suggestion, I chose a practical target: installing Homebrew on Alpine Linux. I understood each step and the current issues faced, then I wrote an article describing the installation process.

According to the current tier policy, Alpine Linux should be considered Tier 2. Since Homebrew doesn't appear to be interested in migrating its images to Alpine, I didn't add CI tests running on Alpine Linux.

The current issues of installing and running Homebrew on Alpine Linux are:

  • It needs to patch ldd for installation.
    • This is unavoidable, Apline Linux is based on musl libc.
  • It needs long options of grep and sort for installation, but busybox do not support them.
    • This would be unneeded after this PR merged.
  • It needs /usr/bin/stat existing for installation, but Alpine Linux only has /bin/stat.
  • brew shellenv needs ps to support -p option, but busybox do not support it.
    • -p is POSIX-required, that should be fixed by busybox.
    • This can be bypassed by explicitly providing the second argument, such as brew shellenv sh.
  • brew list needs ls to support -q option, but busybox do not support it.
    • -q is POSIX-required, that should be fixed by busybox.
    • We can use a stub script to patch the ls command.
  • The uninstallation script need find to support -lname option, but busybox do not support it.
    • The uninstallation script is not used often. It would be easy to edit it before executing it.

In summary, the changes involved in this PR are all the required changes.

@Bo98
Copy link
Member

Bo98 commented Aug 3, 2025

Perhaps we could use git tag --list --sort=-version:refname which will remove the need to pipe to sort. I believe that should be supported in 2.7.0 (our minimum required version) and should be a net benefit to both readability and portability.

For your other points, I agree with them. In cases where we're already using POSIX options then it's generally on busybox to fix those. For the uninstall script, the proposed alternative to -lname is too verbose. For musl libc, it would fall under either tier 3 or unsupported (depending on how functional it is) and as such the installer not supporting that is intentional as that has a higher bar. For musl support in brew itself: we may review PRs if trivially small (like how we did for PPC), otherwise a fork is preferred for larger changes, should anything even be required.

@chirsz-ever chirsz-ever force-pushed the chirsz/250804-short-option branch from 70c9773 to a6e82d7 Compare August 4, 2025 03:04
@chirsz-ever
Copy link
Contributor Author

Perhaps we could use git tag --list --sort=-version:refname which will remove the need to pipe to sort. I believe that should be supported in 2.7.0 (our minimum required version) and should be a net benefit to both readability and portability.

Thanks. It is indeed supported in version 2.7.01. I modified the commit as you advised.

Footnotes

  1. https://git-scm.com/docs/git-tag/2.6.7

@chirsz-ever chirsz-ever force-pushed the chirsz/250804-short-option branch from a6e82d7 to 1498cc5 Compare August 4, 2025 13:25
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try it out! Thanks.

Support the environment not supporting long option, such as Alpine Linux
with busybox.
@chirsz-ever chirsz-ever force-pushed the chirsz/250804-short-option branch from 1498cc5 to 75b1e68 Compare August 4, 2025 14:40
@MikeMcQuaid MikeMcQuaid enabled auto-merge August 4, 2025 14:51
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Aug 4, 2025
Merged via the queue into Homebrew:main with commit e1210ab Aug 4, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants