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

OSRFUNIXBase: brew remove git if it is corrupted #696

Closed
wants to merge 3 commits into from

Conversation

scpeters
Copy link
Contributor

@scpeters scpeters commented Apr 9, 2022

macOS has a system version of git at /usr/bin/git, but sometimes brew installs a version of git at /usr/local/bin/git. Sometimes the brew version of git can be broken if one of its dependencies, such as gettext is missing or broken, as was recently noticed with glados:

+ git clone https://github.com/ignition-tooling/release-tools scripts -b master
dyld: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/git
  Reason: image not found

which I can trace back to an aborted build:

+++ /usr/local/bin/brew remove --force --ignore-dependencies ca-certificates ccache cmake console_bridge doxygen eigen gazebo11-bottle.tar gdbm gettext git hiredis ignition-cmake2 ignition-cmake2-bottle.tar ignition-common3-bottle.tar ignition-fuel-tools1-bottle.tar ignition-fuel-tools4-bottle.tar ignition-fuel-tools6-bottle.tar ignition-gazebo3-bottle.tar ignition-gazebo5-bottle.tar ignition-gui3-bottle.tar ignition-launch5-bottle.tar ignition-math6 ignition-rendering4-bottle.tar ignition-rendering6-bottle.tar ignition-sensors6-bottle.tar ignition-tools ignition-tools-bottle.tar libyaml mpdecimal [email protected] pcre2 pkg-config [email protected] readline ruby sdformat10-bottle.tar sdformat12-bottle.tar sdformat9 sqlite tbb@2020_u3-bottle.tar tinyxml urdfdom urdfdom_headers xz zstd
Uninstalling ca-certificates... (3 files, 211.7KB)
Uninstalling ccache... (68 files, 1.4MB)
Uninstalling cmake... (3,042 files, 45.2MB)
Uninstalling console_bridge... (13 files, 75.7KB)
Uninstalling doxygen... (1,156 files, 28MB)
Uninstalling eigen... (546 files, 8.4MB)
Uninstalling gdbm... (24 files, 973KB)
Uninstalling gettext... (1,953 files, 19.8MB)
Error: Could not remove gettext keg! Do so manually:
  sudo rm -rf /usr/local/Cellar/gettext/0.21
Build was aborted

This is a hacky attempt to recover from this problem by trying to brew remove git and its dependencies if git --version fails. My first test from this branch successfully removed git, but it failed on the subsequent git clone because bash's hash table was expecting git to be in /usr/local/bin/git. I suppose we could add && brew install git to the end of this new line as well?

@scpeters scpeters closed this Nov 9, 2023
@scpeters scpeters deleted the scpeters/brew_remove_broken_git branch November 9, 2023 17:46
@scpeters scpeters restored the scpeters/brew_remove_broken_git branch August 13, 2024 22:37
@scpeters scpeters reopened this Aug 13, 2024
@scpeters
Copy link
Contributor Author

scpeters commented Aug 13, 2024

I suppose we could add && brew install git to the end of this new line as well?

I tried this in 7261cad and tested, but it didn't fix that issue. I'll close this and open an alternate fix

Build Status https://build.osrfoundation.org/view/gz-fortress/job/gz_utils1-install_bottle-homebrew-amd64/244/

# BEGIN SECTION: clean up /usr/local
+ export HOMEBREW_NO_INSTALL_FROM_API=1
+ HOMEBREW_NO_INSTALL_FROM_API=1
+ . ./scripts/jenkins-scripts/lib/_homebrew_cleanup.bash
++ set -e
++ BREW_BINARY_DIR=/usr/local/bin
++ BREW_BINARY=/usr/local/bin/brew
+++ /usr/local/bin/brew --repo
++ git -C /usr/local/Homebrew fsck
dyld[5680]: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
  Referenced from: <04E66D94-A65C-3D78-B065-04AA634DBB33> /usr/local/Cellar/git/2.46.0/bin/git
  Reason: tried: '/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file), '/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file), '/usr/local/lib/libintl.8.dylib' (no such file), '/usr/lib/libintl.8.dylib' (no such file, not in dyld cache)
./scripts/jenkins-scripts/lib/_homebrew_cleanup.bash: line 13:  5680 Abort trap: 6           git -C $(${BREW_BINARY} --repo) fsck
Build step 'Execute shell' marked build as failure

@scpeters scpeters closed this Aug 13, 2024
@scpeters scpeters deleted the scpeters/brew_remove_broken_git branch August 13, 2024 22:51
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.

1 participant