Repository navigation
Preserve UTF-8 paths in ELF loader strings - #24349
Conversation
- Validate ELF loader strings as UTF-8 before checking paths, so valid non-ASCII references reach bottle relocation detection. - Keep rejecting invalid byte sequences and cover loader paths and the binary relocation metadata produced by `brew bottle`.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
UTF-8 relocation strings and validation Library/Homebrew/keg_relocate.rb, Library/Homebrew/test/keg_relocate/elf_checker_spec.rb, Library/Homebrew/test/dev-cmd/bottle_spec.rb |
Extraction retains valid UTF-8 matches with their hexadecimal offsets. Tests cover non-ASCII RPATH and interpreter paths, invalid UTF-8 exclusion, and an ELF dependency in bottle relocation. |
Priority:
Merge Risk: 
Minimal · up to f9759
-
No actionable merge-blocking risk is established for this change.
Pre-merge checks: 
4
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
🟢 Approval recommended
The reviewed changes address the UTF-8 path regression with focused implementation updates and comprehensive regression coverage.
No open issues 🎉
What changed in this PR
This pull request preserves valid UTF-8 paths when scanning ELF loader strings, ensuring non-ASCII library and interpreter paths are included in bottle relocation metadata while invalid byte sequences remain excluded.
Changes:
- Validate ELF loader strings as UTF-8 rather than ASCII-only.
- Add regression tests for UTF-8 and invalid-encoding RPATHs and interpreter paths.
- Extend bottle integration coverage for ELF binaries referencing UTF-8 library paths.
| File | Description |
|---|---|
Library/Homebrew/test/keg_relocate/elf_checker_spec.rb |
Tests UTF-8 RPATHs, interpreter paths, and invalid UTF-8 rejection. |
Library/Homebrew/test/dev-cmd/bottle_spec.rb |
Verifies bottle metadata records ELF binaries with UTF-8 library references. |
Library/Homebrew/keg_relocate.rb |
Preserves valid UTF-8 ELF relocation strings while rejecting invalid encodings. |
Review effort: Lite
brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Codex (GPT-6) wrote the fix and regression tests, with a red/green check of the new examples and inspection of the JSON produced by
brew bottle.Keg.elf_relocation_stringsdiscards loader strings containing non-ASCII bytes, including valid UTF-8 paths. An existing library referenced asCellar/foo/1.0/José/libhello.so.0is therefore omitted from the bottle's binary relocation metadata.Validate candidates as UTF-8 so these paths reach the existing path checks, while continuing to reject invalid byte sequences. Add coverage for non-ASCII RPATHs and interpreter paths, and extend the existing
brew bottleintegration example with an absolute ELF library reference.To reproduce with the regression examples:
With the original filter, both loader path examples return no matches and the bottle JSON omits
libexec/elf-prefixfrombinary_relocation_files. The new filter preserves those matches and records the ELF file.