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

Truncate overly long --command matches #35

Merged
merged 2 commits into from
Jan 19, 2025
Merged

Truncate overly long --command matches #35

merged 2 commits into from
Jan 19, 2025

Conversation

martinpitt
Copy link
Owner

/proc/pid/comm is at most 15 characters (plus NUL), so specifying a
longer --command value will never match. Truncate it to the maximum
and warn about it.

Note that the manpage speaks about TASK_COMM_LEN, but that isn't
defined anywhere. So define it ourselves.

Fixes #33

[1] https://man7.org/linux/man-pages/man5/proc_pid_comm.5.html

/proc/pid/comm is at most 15 characters (plus NUL), so specifying a
longer `--command` value will never match. Truncate it to the maximum
and warn about it.

Note that the manpage speaks about `TASK_COMM_LEN`, but that isn't
defined anywhere. So define it ourselves.

Fixes #33

[1] https://man7.org/linux/man-pages/man5/proc_pid_comm.5.html
@martinpitt martinpitt merged commit e32af28 into main Jan 19, 2025
10 checks passed
@martinpitt martinpitt deleted the long-comm branch January 19, 2025 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trim or warn about process names longer than 15 characters
1 participant