Skip to content

cond: fixup path buffer size to fit the longest condition name - #495

Merged
troglobit merged 1 commit into
finit-project:masterfrom
aanderse:cond/bufferlen
Aug 6, 2026
Merged

cond: fixup path buffer size to fit the longest condition name#495
troglobit merged 1 commit into
finit-project:masterfrom
aanderse:cond/bufferlen

Conversation

@aanderse

@aanderse aanderse commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

cond_path() and cond_checkpath() built the /run/finit/cond/ path in a MAX_ARG_LEN buffer, so condition names longer than ~40 chars were truncated.


context: i started using tasks to mount disks in the finix initramfs (.mount units anyone? 😆) so i can mount in parallel, speed things up, properly order other tasks, etc... i found a bug where some longer paths created tasks which wouldn't create conditions under /run/finit/cond/... for example:

task wait-dev:dev-disk-by-label-FINIX_LIVE {
  command = "/nix/store/4a021xa6sr06qq58ixnqiq2h5zsg5sln-wait-dev_dev-disk-by-label-FINIX_LIVE"
  conditions = {  }
  runlevel = "S"
}

i did a bit of testing and with these patches seems fine now 👍

cond_path() and cond_checkpath() built the /run/finit/cond/ path in a
MAX_ARG_LEN buffer, so condition names longer than ~40 chars were
truncated.

@troglobit troglobit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice catch! 💪

@troglobit
troglobit merged commit d2781ef into finit-project:master Aug 6, 2026
2 checks passed
@aanderse
aanderse deleted the cond/bufferlen branch August 6, 2026 11:05
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