s6-rc-update does not create pipes when already-running service becomes a consumer

2023-09-26 Thread Adam Joseph
A simple script to demonstrate this problem is attached below. It appears that s6-rc-update will neglect to create the needed pipes in the following situation: 1. A service X is already running before s6-rc-update is invoked 2. Service X was not the consumer-for any other service prior to s6-rc-u

Re: [PATCH 3/3] [WIP] s6-rc-update.c: add additional comments

2023-09-25 Thread Adam Joseph
Quoting Adam Joseph (2023-09-25 17:44:18) > + /* > +Note: the following will fail if you have a singleton bundle > +and try to rename both the bundle and the thing it contains > +in the same s6-rc-update invocation. Parts of this loop > +sho

Re: [PATCH 2/3] s6-rc-update.c: rewrite O(n^2) loop as O(n) complexity

2023-09-25 Thread Adam Joseph
Quoting Adam Joseph (2023-09-25 17:44:17) > The loop is O(n^2) due to the nested iteration. We can rewrite this > with a single iteration by making use of the invimage[] array, which > maps from new services to old services: > >for each new service > if *ANY* old servi

[PATCH 3/3] [WIP] s6-rc-update.c: add additional comments

2023-09-25 Thread Adam Joseph
This commit adds additional explanatory comments for parts of s6-rc-update.c that did not seem immediately obvious to me. It is probably not appropriate to apply this commit verbatim in its current form. Feel free to pick changes from it selectively. Signed-off-by: Adam Joseph --- src/s6-rc

[PATCH 2/3] s6-rc-update.c: rewrite O(n^2) loop as O(n) complexity

2023-09-25 Thread Adam Joseph
services: for each new service if *ANY* old service converts to the new service, set some new service flags based on that old service's flags This takes advantage of the fact that invimage is an injective (partial) function. Signed-off-by: Adam Joseph --- src/s6-rc/s6-rc-upd

[PATCH 1/3] s6-rc-update.c: add #define constants for bitflags

2023-09-25 Thread Adam Joseph
than add the descriptive identifiers and replace integers with their corresponding identifier-combinations. Therefore it should be straightforward to locally verify the correctness of each change in this commit. Signed-off-by: Adam Joseph --- src/s6-rc/s6-rc-update.c | 167 +++-

[PATCH] libs6rc/s6rc_graph_closure.c: add comments explaining behavior

2023-09-25 Thread Adam Joseph
immediately obvious to me. Signed-off-by: Adam Joseph --- src/libs6rc/s6rc_graph_closure.c | 13 + 1 file changed, 13 insertions(+) diff --git a/src/libs6rc/s6rc_graph_closure.c b/src/libs6rc/s6rc_graph_closure.c index 7c3a8f9..50af30b 100644 --- a/src/libs6rc/s6rc_graph_closure.c +++ b/src

[PATCH 2/2] doc: define "singleton bundle", document special rules

2023-09-25 Thread Adam Joseph
While reviewing the source code for s6-rc-update I noticed that it has special handling for singleton bundles; these are not explicitly defined in the documentation, nor is this behavior described. This commit does so. Signed-off-by: Adam Joseph --- doc/s6-rc-compile.html | 9 + doc

[PATCH 1/2] doc/s6-rc-compile.html: document bundle flattening

2023-09-25 Thread Adam Joseph
rules for singleton bundles (see next patch in series) depend on this flattening behavior. Signed-off-by: Adam Joseph --- doc/s6-rc-compile.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/s6-rc-compile.html b/doc/s6-rc-compile.html index e1ad82b..ef06893 100644 --- a/doc/s6-rc