Skip to content

dlopen-notes: make output stable regardless of order of inputs#56

Merged
bluca merged 1 commit into
systemd:mainfrom
bluca:ordering
Jun 5, 2026
Merged

dlopen-notes: make output stable regardless of order of inputs#56
bluca merged 1 commit into
systemd:mainfrom
bluca:ordering

Conversation

@bluca

@bluca bluca commented Jun 5, 2026

Copy link
Copy Markdown
Member

When multiple files are passed to dlopen-notes --sonames the output depends on the order of inputs in case the same soname is used with different priorities across different binaries:

$ ./dlopen-notes.py --sonames systemd-sbsign systemd-repart libblkid.so.1 required
libcrypto.so.3 recommended
libcryptsetup.so.12 recommended
libfdisk.so.1 required
libmount.so.1 required
$ ./dlopen-notes.py --sonames systemd-repart systemd-sbsign libblkid.so.1 required
libcrypto.so.3 required
libcryptsetup.so.12 recommended
libfdisk.so.1 required
libmount.so.1 required

sbsign requires libcrypto, and repart recommends it, so the output changes between required and recommended depending on which is passed last.

Fix it so that the highest priority for any given soname is always returned, regardless of the number of input binaries.

@bluca bluca requested a review from keszybz June 5, 2026 10:40

@behrmann behrmann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks reasonable to me, does what it says on the tin (current binaries from systemd main required): instead of eagerly throwing out priorities and having the last one win, because the dictionary is built at the end, build the whole mapping first and always update to the priority. It's a bit circumspect, because the dict gets built twice, as noted below, but it does the job.

Comment thread dlopen-notes.py Outdated
When multiple files are passed to dlopen-notes --sonames the output
depends on the order of inputs in case the same soname is used
with different priorities across different binaries:

$ ./dlopen-notes.py --sonames systemd-sbsign systemd-repart
libblkid.so.1 required
libcrypto.so.3 recommended
libcryptsetup.so.12 recommended
libfdisk.so.1 required
libmount.so.1 required

$ ./dlopen-notes.py --sonames systemd-repart systemd-sbsign
libblkid.so.1 required
libcrypto.so.3 required
libcryptsetup.so.12 recommended
libfdisk.so.1 required
libmount.so.1 required

sbsign requires libcrypto, and repart recommends it, so the output
changes between required and recommended depending on which is passed last.

Fix it so that the highest priority for any given soname is always
returned, regardless of the number of input binaries.

@behrmann behrmann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yep, that's what I meant. A bit more involved, but only builds the dictionary once.

@bluca bluca merged commit 7685331 into systemd:main Jun 5, 2026
1 check passed
@bluca bluca deleted the ordering branch June 5, 2026 15:33
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