Conversation
makedir() returns 0 when the directory already exists, so the EEXIST
branch never ran and existing directories never had their mode fixed.
chown() on the other hand ran every time, which fails with EPERM on an
immutable directory even when the owner is already correct:
tmpfiles: Failed chown(/var/empty, 0, 0): Operation not permitted
Stat the directory and only change the mode or owner if it differs.
|
Worth noting, previously this portion of the code was using just a call to |
sbrkopac
marked this pull request as draft
September 22, 2026 20:13
troglobit
requested changes
Sep 23, 2026
troglobit
left a comment
Collaborator
There was a problem hiding this comment.
You have to flip it or we'll get a TOCTOU error instead that Covertly will flag. Ie, on error check why before logging.
Collaborator
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.
on finix /var/empty is immutable, so every boot logs
drules chown the directory unconditionally, even when nothing needs tochange. this stats it first and skips chmod/chown when mode and owner
already match, the same direction mksubsysd() went in 6b03a1e.
heads up that the old
errno == EEXISTchmod branch was dead, sincemakedir() already swallows EEXIST. so existing directories with the wrong
mode will now actually get fixed, which i think was the intent.
tested with a finix vm test that runs a matching
drule on achattr +idirectory. it fails on 4.17 and passes with this.