Repository navigation
ldso-cache: match glibc ldconfig directory and entry ordering - #2598
Merged
Merged
Conversation
Scan the ld.so.conf directories first, then the built-in /lib and /usr/lib, as glibc's ldconfig does, dropping duplicate directories. Skip /lib when it is a symlink (usrmerge) so libraries are not listed twice. Sort cache entries stably, breaking _dl_cache_libcmp ties on flags as glibc's compare() does, so that the first directory providing a library is the one ld.so picks. Also fix ParseLDSOConf returning after the first include directive, which silently dropped any directories listed after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xnox
enabled auto-merge (squash)
October 23, 2026 16:59
dannf
approved these changes
Oct 23, 2026
EyeCantCU
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ld.so.confdirectories first, then the built-in/liband/usr/lib, matching glibc'sldconfig(elf/ldconfig.c). Previously/libwas scanned first and/usr/libwas never added implicitly. Duplicate directories are dropped, keeping the first./libentirely when it is a symlink, so libraries are not listed twice._dl_cache_libcmpties on flags (descending), mirroringcompare()in glibc'self/cache.c.ld.souses the first matching entry, so the first directory that provides a library now reliably wins. Previously the unstable sort left this undefined.ParseLDSOConfinclude bug: parsing returned right after the firstincludedirective, silently dropping any directories listed after it. Included directories are now deduplicated too.Testing
TestLdsoLibDirs(split/lib, usrmerge,/libinld.so.confunder usrmerge, conf precedence).Test_LDSOCacheEntriesForDirs_DuplicatesKeepLibdirOrder.Test_ParseLDSOConf_LinesAfterInclude.go test ./pkg/build/... ./internal/...passes.🤖 Generated with Claude Code