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

shellgen: update store paths when patching glibc #1818

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

gcurtis
Copy link
Collaborator

@gcurtis gcurtis commented Feb 16, 2024

This addresses an issue where scripts (and other text files) could still refer to the unpatched version of a program after enabling patch_glibc. This is one of the reasons why Ruby would still segfault in issue #1772. For example, if you look at bundler (installed by default with ruby) it's a wrapper script with the shebang:

#!/nix/store/vs52hm8jbwgx19plicg02dzz2vmvbyy5-ruby-2.7.8/bin/ruby

This means that commands like bundler exec rails would still run using the unpatched version of ruby. I suspect this was also happening with Python or other packages that rely on wrapper scripts.

The fix updates glibc-patch.bash to grep for the old store path and replace it using sed. It relies on ripgrep's ability to ignore binary files so that we only modify text files.

This addresses an issue where scripts (and other text files) could still
refer to the unpatched version of a program after enabling
`patch_glibc`. This is one of the reasons why Ruby would still segfault
in issue #1772. For example, if you look at `bundler` (installed by
default with `ruby`) it's a wrapper script with the shebang:

	#!/nix/store/vs52hm8jbwgx19plicg02dzz2vmvbyy5-ruby-2.7.8/bin/ruby

This means that commands like `bundler exec rails` would still run using
the unpatched version of ruby. I suspect this was also happening with
Python or other packages that rely on wrapper scripts.

The fix updates glibc-patch.bash to grep for the old store path and
replace it using sed. It relies on ripgrep's ability to ignore binary
files so that we only modify text files.
@gcurtis gcurtis requested a review from savil February 16, 2024 21:22
Copy link
Collaborator

@savil savil left a comment

Choose a reason for hiding this comment

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

nice!

@gcurtis gcurtis merged commit 7f1633f into main Feb 20, 2024
24 checks passed
@gcurtis gcurtis deleted the gcurtis/patch-glibc-paths branch February 20, 2024 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants