Skip to content
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

optionally allow a tolerance when checking script files #233

Merged
merged 1 commit into from
Jan 28, 2022
Merged

optionally allow a tolerance when checking script files #233

merged 1 commit into from
Jan 28, 2022

Conversation

bugfood
Copy link
Contributor

@bugfood bugfood commented Jan 27, 2022

This addresses:
#228
...without being a complete "fix", since that does not seem to be
possible.

Further details are in the bug report above, but in brief, Linux can
only report process start time with a precision of 1.1 seconds, and that
gets rounded off, thus false positives are quite possible for processes
that start immediately after their files are created.

Since this can allow some false negatives, allow the user to decide.
The default tolerance of 0 is no change from the previous behavior of
having no tolerance.

@bugfood
Copy link
Contributor Author

bugfood commented Jan 27, 2022

I don't know if I accounted for all potential uses of the tolerance value; the only check I could find that uses process start time is the script check.

Before (or after with tolerance unspecified):

# PERL5LIB=perl/lib ./needrestart -plk
WARN - Kernel: <redacted>, Services: 1 (!), Containers: none, Sessions: none|Kernel=0;0;;0;2 Services=1;;0;0 Containers=0;;0;0 Sessions=0;0;;0
Services:
- <redacted>.service

After, with tolerance specified:

# PERL5LIB=perl/lib ./needrestart -plk -t 2
OK - Kernel: <redacted>, Services: none, Containers: none, Sessions: none|Kernel=0;0;;0;2 Services=0;;0;0 Containers=0;;0;0 Sessions=0;0;;0

Thanks,
Corey

man/needrestart.1 Outdated Show resolved Hide resolved
needrestart Outdated Show resolved Hide resolved
needrestart Outdated Show resolved Hide resolved
@liske liske added the bug label Jan 28, 2022
@liske liske added this to the v3.6 milestone Jan 28, 2022
This addresses:
#228
...without being a complete "fix", since that does not seem to be
possible.

Further details are in the bug report above, but in brief, Linux can
only report process start time with a precision of 1.1 seconds, and that
gets rounded off, thus false positives are quite possible for processes
that start immediately after their files are created.

Since this can allow some false negatives, allow the user to decide.
The default tolerance of 2 should accomodate common use cases without
causing excessive false negatives.
@liske liske merged commit fa8319d into liske:master Jan 28, 2022
@liske
Copy link
Owner

liske commented Jan 28, 2022

Thanks for your contribution!

@bugfood
Copy link
Contributor Author

bugfood commented Jan 28, 2022

You're welcome, and thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants