Skip to content

keventd: fix by-id symlinks for partitions - #510

Closed
FixeQD wants to merge 2 commits into
finit-project:masterfrom
FixeQD:fix/keventd-partition-symlinks
Closed

FixeQD wants to merge 2 commits into
finit-project:masterfrom
FixeQD:fix/keventd-partition-symlinks

Conversation

@FixeQD

@FixeQD FixeQD commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

I've found them while writing the finix keventd's VM tests, only the keventd backend failed to create virtio-<serial>-part1 after hotplugging a GPT disk.

Two bugs:

  1. $attr{} / %s{} read only the device's own sysfs directory, while the matching key ATTRS{} walks parents. Partitions have no serial of their own, so ID_SERIAL came out empty and the shipped rule published virtio--part1. Affects the nvme, ieee1394 and mmc partition rules too.
    The fix adds sysfs_read_attr_chain(), which falls back to sysfs_parent_walk().
  2. disk_serial_id() falls back to <disk>/../serial, so a partition got a by-id link named after its parent disk's serial, overwriting the whole disk's link.
    The fix skips for DEVTYPE=partition.

Attribute substitution only looked at the device's own sysfs directory,
while the matching key ATTRS{} walks parents. Devices without an
attribute of their own, partitions in particular whose serial lives in
the parent disk, therefore substituted to an empty string.
disk_serial_id() falls back to <disk>/../serial so a partition got a
by-id link named after its parent disk's serial, clobbering the link
created for the whole disk.
@troglobit

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

@FixeQD

FixeQD commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Uhhh... Is it going to start? Or I should resolve them, they look easy

@troglobit

Copy link
Copy Markdown
Collaborator

Uhhh... Is it going to start? Or I should resolve them, they look easy

Good question, I'll have a look. Would be neat to not have to do such stuff ourselves :-)

@FixeQD

FixeQD commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Alr, btw welcome back to finit :D

@troglobit

Copy link
Copy Markdown
Collaborator

Alr, btw welcome back to finit :D

Heh, yeah I've been in the wars lately. A bit too much going on at $DAYJOB atm. 😅

@troglobit

Copy link
Copy Markdown
Collaborator

Copilot failed miserably at this simple task, so I've cherry-picked the partition fix (your second commit) onto master as c03059a. The first commit conflicted with #516, which fixes the same thing the way udev does it: $attr{} falls back to the parent matched by ATTRS{serial}=="?*". Your virtio -part1 case is covered by that, so I've left the first commit out.

@troglobit troglobit closed this Nov 13, 2026
@FixeQD

FixeQD commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Alr, thanks

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.

2 participants