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

linux/diagnostic: add check for versioned GCC linkage #13639

Merged
merged 1 commit into from
Aug 23, 2022
Merged

linux/diagnostic: add check for versioned GCC linkage #13639

merged 1 commit into from
Aug 23, 2022

Conversation

carlocab
Copy link
Member

@carlocab carlocab commented Aug 3, 2022

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

This complements my other two GCC-on-Linux PRs (#13631, #13633), however
they are both reliant on bottles eventually being (re-)poured.

Let's try to speed that up by returning an error message from brew doctor
whenever a user has formulae installed that would benefit from a brew reinstall.

This complements my other two GCC-on-Linux PRs (#13631, #13633), however
they are both reliant on bottles eventually being (re-)poured.

Let's try to speed that up by returning an error message from `brew doctor`
whenever a user has formulae installed that would benefit from a `brew reinstall`.
@BrewTestBot
Copy link
Member

Review period will end on 2022-08-04 at 13:00:15 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Aug 3, 2022
@carlocab
Copy link
Member Author

carlocab commented Aug 3, 2022

As before, I still need to test this. But this is the proof-of-concept.

@@ -139,6 +139,34 @@ def check_linuxbrew_bottle_domain
e.g. by using homebrew instead).
EOS
end

def check_gcc_dependent_linkage
Copy link
Member Author

Choose a reason for hiding this comment

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

This could be very slow. On the other hand, brew doctor isn't run all that often.

Copy link
Member

Choose a reason for hiding this comment

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

@carlocab Would be good to benchmark how much slower it ends up being?

Copy link
Member Author

Choose a reason for hiding this comment

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

@Homebrew/linux would appreciate help with testing and benchmarking. Using Docker on macOS is not fun 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, this may take me a bit, but the exercise I plan to do is to install 100 randomly selected GCC dependents:

brew ruby <<EOS | xargs brew install
require 'formula'
gcc_dependents = Formula.all.select { |f| f.deps.map(&:name).include? "gcc" }
puts gcc_dependents.sample(100)
EOS

and then test brew doctor against this branch and against master.

Copy link
Member Author

Choose a reason for hiding this comment

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

Assuming I did this correctly, brew doctor benchmarks should be in the markdown summary on this page in about an hour or so: https://github.com/carlocab/workflow-test/actions/runs/2804210379

Copy link
Member Author

Choose a reason for hiding this comment

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

System.IO.IOException: No space left on device : '/home/runner/runners/2.294.0/_diag/Worker_20220805-142208-utc.log'

Oops.

Comment on lines +156 to +160
paths = binary.rpath.split(":")
versioned_linkage = paths.any? { |path| path.match?(%r{lib/gcc/\d+$}) }
unversioned_linkage = paths.any? { |path| path.match?(%r{lib/gcc/current$}) }

versioned_linkage && !unversioned_linkage
Copy link
Member Author

Choose a reason for hiding this comment

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

What I should be doing here is checking that the current directory precedes the versioned directory whenever the versioned directory is found, but I'm still thinking of the right way to do that.

In any case, if this check is something we want to do, then this is still an improvement over not checking, and we can iterate on this later. But, suggestions very much welcome.

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.

Approach seems reasonable. Perhaps worth doing a benchmark and maybe checking on the setting that should have migrated all of these?

@Bo98
Copy link
Member

Bo98 commented Aug 3, 2022

Is this for the scenario where the user doesn't use brew update?

@carlocab
Copy link
Member Author

carlocab commented Aug 4, 2022

I'll admit to not having thought too carefully about failure modes yet: my motivation is that it would be good to provide as many paths to brew reinstall as possible to minimise breakage.

Something like this (omitting the #core_tap? check) might help for your concern over source-built formulae from #13633 (comment), though.

@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Aug 4, 2022
@BrewTestBot
Copy link
Member

Review period ended.

@carlocab
Copy link
Member Author

carlocab commented Aug 5, 2022

Benchmarked:

Before

Command Mean [s] Min [s] Max [s] Relative
brew doctor 5.248 ± 0.053 5.166 5.328 1.00

After

Command Mean [s] Min [s] Max [s] Relative
brew doctor 2.915 ± 0.033 2.862 2.957 1.00

This is on a system with about ~430 formulae installed, which is pretty extreme.

This means brew doctor is nearly twice as slow as before, which is pretty bad. OTOH, it didn't take long at all to run before, so it's not too bad in the end.

@MikeMcQuaid
Copy link
Member

This means brew doctor is nearly twice as slow as before, which is pretty bad. OTOH, it didn't take long at all to run before, so it's not too bad in the end.

Yeh, I think that's too slow to run for everyone every time 😭.

@carlocab
Copy link
Member Author

carlocab commented Aug 5, 2022

Running some slightly more comprehensive benchmarks here: https://github.com/carlocab/workflow-test/actions/runs/2805207136/attempts/1#summary-7696068383

One of the runs is still going, but the ones that finished are a bit all over the place.

I'm ok to leave this be for now. We can reconsider it depending on the number of users who report issues that might be helped by this.

@MikeMcQuaid
Copy link
Member

I'm ok to leave this be for now. We can reconsider it depending on the number of users who report issues that might be helped by this.

Shouldn't this be handled automatically by brew update? If so, can we check if the setting is set, make this a no-op if so and tell them to run brew update if anything fails? Similarly, we could make it fail the first time we find a single failure rather than getting all the failures from all formulae.

@MikeMcQuaid MikeMcQuaid merged commit d550d57 into Homebrew:master Aug 23, 2022
@MikeMcQuaid
Copy link
Member

Let's ship this and revert if it's causing issues/too slow.

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

Successfully merging this pull request may close these issues.

4 participants