Exit code equals 1 if configuration file is not owned by root#508
Exit code equals 1 if configuration file is not owned by root#508sblondon wants to merge 3 commits intologrotate:masterfrom sblondon:exit_code_for_error
Conversation
|
I changed the two MESS_ERROR to MESS_WARN you agreed. I did not add tests because the code has to be runned by root due to the condition |
kdudka
left a comment
There was a problem hiding this comment.
Thanks for the update! As for the tests, one could instrument the call to getuid() at run-time. But let's not overcomplicate it.
Ok. |
|
No worries. I will update the change log in a batch before the next release. I plan to merge this in a few days unless there is any more discussion. Thanks for the contribution! |
The PR 448 let me think the error messages strategy is:
MESS_ERROR if the error stops
logrotate. So exit value should not be 0.MESS_WARNING if it's possible to continue to run
logrotate. Exit value is 0.Currently, if configuration file is not owner by root,
logrotateexits with 0 as exit code (it's in confic.c ):This PR changes the exit code to 1.
I found two cases where it should use
MESS_WARNINGbecause configuration lines are ignored:I can add them to the PR if you think it's the correct behavior.
Tests are all green. I didn't understand how to modify them to add exit value assertion and didn't find documentation about them. So, there is no additional test.