process_matcher: Fix accidentally matching against pid#328
Merged
cakebaker merged 1 commit intouutils:mainfrom Feb 19, 2025
Merged
process_matcher: Fix accidentally matching against pid#328cakebaker merged 1 commit intouutils:mainfrom
cakebaker merged 1 commit intouutils:mainfrom
Conversation
Contributor
|
would it be possible to add a test to make sure we don't regress? thanks |
Currently pgrep/pkill without -x/-f flags is matching based on the first 15 characters of /proc/<pid>/stat, which actually contains something like "1116878 (cat) R" thus matching the process id when it should just match on the name. This has probably come from misunderstanding the comment from manpage: > The process name used for matching is limited to the 15 characters > present in the output of /proc/pid/stat. ... which doesn't mean pgrep/pkill is literally matching on 15 characters of /proc/<pid>/stat but that the process name in that file is truncated to 15 characters. Fixes uutils#307
1f5d1ae to
43f7412
Compare
Contributor
Author
Added |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #328 +/- ##
===========================
===========================
☔ View full report in Codecov by Sentry. |
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently pgrep/pkill without -x/-f flags is matching based on the first 15 characters of /proc//stat, which actually contains something like "1116878 (cat) R" thus matching the process id when it should just match on the name.
This has probably come from misunderstanding the comment from manpage:
... which doesn't mean pgrep/pkill is literally matching on 15 characters of /proc//stat but that the process name in that file is truncated to 15 characters.
Fixes #307