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

stages/files: filter out non-existent paths before relabeling #1789

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Jan 16, 2024

The code that handles systemd unit enablement via preset will no op if
disabling a systemd unit that is already disabled, which means that we
wouldn't create a preset file in that case. But we did mark the preset
file as needing relabeling unconditionally. Since setfiles errors out
if you pass it a path that doesn't exist, this would break boot.

Fix this by filtering out all entries that don't exist right before we
call setfiles. Another approach would've been to only mark the file
for relabeling if we actually did write the file, but this is more
complex than it seems because the relabeling logic needs to know what
is the first component in the path that had to be created. So we'd need
logic both before and after file creation.

This isn't user-reported; we hit this in a CI test.

This makes the release note item more similar to the language used in our
release notes.
The code that handles systemd unit enablement via preset will no op if
disabling a systemd unit that is already disabled, which means that we
wouldn't create a preset file in that case. But we did mark the preset
file as needing relabeling unconditionally. Since `setfiles` errors out
if you pass it a path that doesn't exist, this would break boot.

Fix this by filtering out all entries that don't exist right before we
call `setfiles`. Another approach would've been to only mark the file
for relabeling if we actually did write the file, but this is more
complex than it seems because the relabeling logic needs to know what
is the first component in the path that had to be created. So we'd need
logic both before and after file creation.

This isn't user-reported; we hit this in a CI test.
Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

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

trivial LGTM

@jlebon jlebon merged commit a7e36b7 into coreos:main Jan 16, 2024
9 checks passed
@jlebon jlebon deleted the pr/relabel-missing branch January 16, 2024 21:11
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