diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2008-05-28 06:15:32 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2008-05-28 06:15:32 -0700 |
commit | 624f46bdf8b7fbcd37823b45a4ac7b4422c559a1 (patch) | |
tree | 37a818d8b393ba30ae97a07564919a240e88464b /test | |
parent | 32c69fb74cbc8f881b1e2a65da050281348bc4a8 (diff) |
Use changed fields to fix dep solver in remove case
When told to remove services through initd_remove_recurse_deps, their
changed fields are cleared to indicate that they will no longer be
available. This is an improvement over the previous hack where the
active bits were being cleared and then restored at the end of the
function.
With the changed fields cleared, we can skip services that are currently
active, but will be going away in add_all_actives. This fixes a bug
where a service can be asked to be removed, but then added right back in
because it's currently active.
When each rc level is verified after recursion has completed, the added
services are checked to see if they are marked for removal. This fixes a
bug where a service was asked to be removed, but added back because it
was a dependency of another service. When each service is verified at
that level, it is marked to change to active.
Using the changed field clearing in remove_recurse_deps and the setting
in verify_level, we should be able to install and remove scripts just by
checking the changed field.
Finally, fixed two tests which were passing with false positives due to
these bugs.
Diffstat (limited to 'test')
-rw-r--r-- | test/trem-deps.c | 5 | ||||
-rw-r--r-- | test/tremove.c | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/test/trem-deps.c b/test/trem-deps.c index e6501d7..a4b79b1 100644 --- a/test/trem-deps.c +++ b/test/trem-deps.c @@ -14,8 +14,11 @@ int main(int argc, char *argv[]) initd_list_t *all, *startlist, *stoplist; dep_t *rem = dep_new(); - if (argc <= 1) + if (argc <= 1) { dep_add(rem, "network"); + dep_add(rem, "bar"); + dep_add(rem, "foo"); + } while (argc > 1) { dep_add(rem, argv[1]); diff --git a/test/tremove.c b/test/tremove.c index 106fe6c..6432ebb 100644 --- a/test/tremove.c +++ b/test/tremove.c @@ -14,8 +14,10 @@ int main(int argc, char *argv[]) initd_list_t *all, *startlist, *stoplist; dep_t *rem = dep_new(); - if (argc <= 1) - dep_add(rem, "mountfs"); + if (argc <= 1) { + dep_add(rem, "foo"); + dep_add(rem, "bar"); + } while (argc > 1) { dep_add(rem, argv[1]); |