Skip to content

Comments

Fix 'initctl reload foo' support#472

Merged
troglobit merged 5 commits intomasterfrom
reload-foo
Feb 10, 2026
Merged

Fix 'initctl reload foo' support#472
troglobit merged 5 commits intomasterfrom
reload-foo

Conversation

@troglobit
Copy link
Collaborator

Ensure initctl reload foo actually de-asserts its conditions so dependent services are properly reloaded/restarted.

Users starting Finit based systems using U-Boot or Barebox may otherwise
not get a visible cursor at their prompt.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
When reloading a specific service with 'initctl reload foo', the
pid/foo and service/foo/ready conditions were never cleared, so
dependent services were not notified of the reload.

Clear the service's pid condition and, for pid/none notify types,
the ready condition before reloading.  The conditions are then
reasserted by the pidfile inotify handler when the service touches
its PID file after processing SIGHUP.

For s6/systemd services the ready condition is left intact since
their readiness notification may not re-trigger on SIGHUP.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Verify that 'initctl reload foo' properly triggers dependent
services by checking that bar gets a new PID after the reload.
Also change the second test case from service/foo/running to
service/foo/ready which is the actual condition set by pidfile.so.

Fix a race in slay where the target process could exit between
the PID lookup and kill -9, causing spurious test failures in
tight kill loops (e.g., start-kill-service.sh).

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the initctl reload NAME command to properly de-assert and reassert service conditions, ensuring dependent services are reloaded or restarted as expected. The core fix adds logic to the reload function in src/api.c that clears service conditions before sending SIGHUP, allowing dependent services to observe the condition change and react accordingly.

Changes:

  • Added condition clearing logic to the reload handler in the init control API
  • Added comprehensive test coverage for per-service reload with dependent services
  • Updated documentation to clarify condition reassertion behavior on reload

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/api.c Core fix: clears service conditions before reload, with special handling for different notification types (PID, systemd, s6)
test/src/serv.c Updated test service to recreate test resources on reload before touching PID file
test/depserv.sh Added test case for verifying dependent services restart when a service is reloaded; tests both pid and ready conditions
test/skel/bin/slay Added error suppression to kill command for test robustness
src/sm.c Removed cursor hiding code during shutdown (unrelated change)
doc/conditions.md Documented that per-service reload clears and reasserts conditions
doc/ChangeLog.md Added changelog entry for the fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@troglobit troglobit requested a review from mattiaswal February 10, 2026 15:12
Copy link
Collaborator

@mattiaswal mattiaswal left a comment

Choose a reason for hiding this comment

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

Great fix 👍

@troglobit troglobit merged commit 9227147 into master Feb 10, 2026
11 checks passed
@troglobit troglobit deleted the reload-foo branch February 11, 2026 03:45
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