Commit 43f7412
committed
process_matcher: Fix accidentally matching against pid
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 #3071 parent a2d49d6 commit 43f7412
File tree
2 files changed
+10
-9
lines changed- src/uu/pgrep/src
- tests/by-util
2 files changed
+10
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 163 | + | |
169 | 164 | | |
170 | 165 | | |
171 | 166 | | |
172 | | - | |
173 | | - | |
174 | | - | |
| 167 | + | |
| 168 | + | |
175 | 169 | | |
176 | 170 | | |
177 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
372 | 379 | | |
373 | 380 | | |
374 | 381 | | |
| |||
0 commit comments