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

Homebrew.munki Install Check Script fails #92

Open
kluppy opened this issue Dec 9, 2024 · 6 comments
Open

Homebrew.munki Install Check Script fails #92

kluppy opened this issue Dec 9, 2024 · 6 comments

Comments

@kluppy
Copy link

kluppy commented Dec 9, 2024

When running brew --version as root the current version number is not always returned.
E.g. in homebrew 4.4.10 brew --version returns 4.4.10 as a standard user but >=4.3.0 when run as root.

When managesdsoftwareupdate runs the install check, it does so as root, the version numbers don't match and munki installs the package again.

@nstrauss
Copy link
Contributor

nstrauss commented Dec 9, 2024

Thanks for reporting this. Able to repro running with sudo manually. It's been long enough I don't remember if this was an issue originally, but I have to imagine I wouldn't have let it slide if it was broken out the gate. Looks like last commit was this past July. Can you open an issue under https://github.com/Homebrew/brew too?

I think the original intention here was to be "more correct" instead of relying on a receipt based install check, but until the issue is fixed, or perhaps maintainers will decline to, that may be the easiest path.

@kluppy
Copy link
Author

kluppy commented Dec 9, 2024

Opened issue 18907 in Homebrew repo, Homebrew/brew#18907.

@kluppy
Copy link
Author

kluppy commented Dec 12, 2024

They closed it out of hand... before I had a chance to respond or ask any further questions. I don't understand why it is hard to print a version number but I guess it is to do with an automated build process.

I am not sure why Mike wasn't able to reproduce. I have tested on a clean macOS 14.7.1 and a very dirty macOS 12.7.6.

@Bo98 suggested a workaround:

Homebrew uses git -C "$(brew --repo)" describe --tags --dirty --abbrev=7 to get version information. If you run that manually under sudo, you may get a better error for the issue you face.

This doesn't produce an error under sudo and produces the expected output, without "Homebrew " prepended.

On a side note, why is the check script not included in the input section of the recipe? (Honest question, please don't read anything I write as being critical of either you or the Homebrew maintainers, I understand what it is like to do hours of work to only have what feels like thankless criticism in return. I appreciate that you have taken the time to share your work to make our lives easier.)

Since it is in the process I couldn't simply remove it within my recipe override.
I think I will remove the check script and rely on the package receipt.

@Bo98
Copy link

Bo98 commented Dec 12, 2024

It's not meant to be a workaround - it's meant to be a debug as that is what brew --version does under the hood. sudo brew --version works fine for me personally, so my guess was git is blocking you from getting the info under sudo somehow. My initial theory was safe.directory settings but if that git command runs fine under sudo for you then I'm not sure.

shallow or no git repository only appears if it can't read the git repo. You can follow the code here: https://github.com/Homebrew/brew/blob/0bcb7648ce209631a1e483c1fdff50842584e209/Library/Homebrew/brew.sh#L444-L496 (the describe cache stuff isn't too relevant as it'll fall back onto the command I mentioned anyway if the cache fails).

@nstrauss
Copy link
Contributor

@kluppy Since I'm not using this recipe right now I'm curious which route you'd prefer to take. Can either switch to a package based install, which may not entirely be stateful, or try switching to git -C "$(brew --repo)" describe --tags --dirty --abbrev=7. Have a preference?

@kluppy
Copy link
Author

kluppy commented Dec 26, 2024

@nstrauss I am happy to rely on package receipts. Sorry for the delay.

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

No branches or pull requests

3 participants