-
Notifications
You must be signed in to change notification settings - Fork 348
Fix systemd unit overrides #3832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Coverity has started complaining about some non-issues, some of which are related to these changes and some of which are not. Sigh. |
@@ -994,7 +994,7 @@ static bool | |||
str_any_of(const char *s, va_list args, uint32_t flags) | |||
{ | |||
if (s == NULL) { | |||
return pcmk_is_set(flags, pcmk__str_null_matches); | |||
return false; | |||
} | |||
|
|||
while (1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well make this while (true)
while you're here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops forgot this; at least it's not important
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are specific to this code, although they're false positives.
Similarly all those new Both of these sets of Coverity errors cause CI builds to fail. So we will have to either rework the code or suppress them. For the purpose of this PR, adding suppressions is fine (as long as no further false positives crop up). |
It looks like coverity just doesn't understand that
Weird. I don't know how coverity decides what to scan. I thought it was just looking at the files changed in a PR, but I guess I'm wrong.
In the interests of hurrying the systemd stuff along and making the backporting job less daunting, I would say let's just suppress them here and deal with them for real elsewhere. |
Use crm_strdup_printf() and pcmk__str_copy() to assert on error. Also rename to systemd_unit_name(), since we handle other unit types. Signed-off-by: Reid Wahl <[email protected]>
This really shouldn't fail. Previously, we warned in this case. However, we ought to make sure the service is cluster-controlled, and a future commit will implement action timeouts via systemd overrides. So we'll actually need to make sure the override succeeds. Signed-off-by: Reid Wahl <[email protected]>
I think this is clearer. The glibc doc also recommends fchmod() over umask(): https://www.gnu.org/software/libc/manual/html_node/Setting-Permissions.html It shouldn't matter in our case. umask() isn't thread-safe, but Pacemaker is single-threaded. Still, setting the permissions explicitly seems clearer. Signed-off-by: Reid Wahl <[email protected]>
Signed-off-by: Reid Wahl <[email protected]>
And improve the corresponding check in one of its callers. Signed-off-by: Reid Wahl <[email protected]>
This is a static function and we never pass in pcmk__str_null_matches. Signed-off-by: Reid Wahl <[email protected]>
Separate the path string creation logic from the directory creation logic. This reduces some duplication. Signed-off-by: Reid Wahl <[email protected]>
Previously, the override directory paths were valid only for systemd resources whose type attribute has no extension and thus defaults to ".service". For example, 'class="systemd" type="httpd"' works, but 'class="systemd" type="httpd.service"' results in an override directory /run/systemd/system/httpd.service.service.d. The same issue affected resources for non-service units. For example, for a resource managing unit "custom.timer", we would create an override directory /run/systemd/system/custom.timer.service.d. In these cases, the overrides would not be applied. This commit fixes that. We also ensure that the [Service] section is added only for service units. Signed-off-by: Reid Wahl <[email protected]>
Best practice and makes Coverity happy. Signed-off-by: Reid Wahl <[email protected]>
Best practice and makes Coverity happy. Signed-off-by: Reid Wahl <[email protected]>
Best practice and makes Coverity happy. Signed-off-by: Reid Wahl <[email protected]>
Best practice and makes Coverity happy. Signed-off-by: Reid Wahl <[email protected]>
I'm not sure it's about that. |
Signed-off-by: Reid Wahl <[email protected]>
Coverity seems not to understand what CRM_CHECK() is doing. Signed-off-by: Reid Wahl <[email protected]>
These have been getting in the way of trying to set timeouts via override files in #3818.