Skip to content

Conversation

@skarnet
Copy link

@skarnet skarnet commented Nov 18, 2025

This change adds compatibility for people who use the old s6 support mechanism of OpenRC: it should fix the issue described in #949.

A service file with an empty command will use a user-provided service directory with the same name as the service file in /var/svc.d, if one exists, rather than attempting to create a service directory from the information given in the service file.

This PR also fixes a bug with the --notify fd:X option in start-stop-daemon, and also ensures that s6-svscan is run with that option, now that the bug doesn't prevent it anymore.

Laurent Bercot added 3 commits November 18, 2025 08:10
In order to avoid breaking things for the 3 users who use the old
s6 support, add compatibility.
When command= is empty and a service directory exists in /var/svc.d,
use that service directory instead of creating it from the service
file data.
When the created notified pipe (often on 4) is the same number as
the notification fd target, dup2() does not clear the FD_CLOEXEC
flag, so the fd gets closed right when exec'ing the daemon,
reporting readiness failure. Fix this by explicitly testing for
the case and clearing the flag when necessary.

Note that this happens because of a call to close_range() right
before the test. close_range() is the real problem, it should
never be used and this bug is a perfect illustration of why; but
getting rid of close_range() is a much more invasive change that
I don't want to commit to right now, especially since navi's plan
is to eventually deprecate start-stop-daemon.
Now that the bug that made it fail is fixed, use the
start-stop-daemon readiness notification mechanism when
launching s6-svscan.

(We do not run s6-svscan under supervise-daemon because that
would needlessly lengthen the supervision chain. Yo dawg,
we heard you like supervisors.)
@navi-desu navi-desu merged commit 6e6afa1 into OpenRC:master Nov 18, 2025
7 checks passed
@navi-desu
Copy link
Member

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