prometheus / procfs

procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
Apache License 2.0
769 stars 319 forks source link

CmdLine does not parse argv[i] with whitespace correctly #581

Closed gkmeaw closed 11 months ago

gkmeaw commented 11 months ago

On Linux, man 5 proc says:

/proc/pid/cmdline This read-only file holds the complete command line for the process, unless the process is a zombie. In the latter case, there is nothing in this file: that is, a read on this file will return 0 characters. The command-line arguments appear in this file as a set of strings separated by null bytes ('\0'), with a further null byte after the last string.

https://github.com/prometheus/procfs/blob/master/proc.go#L140 splits by whitespace. We should split by null byte instead.

gkmeaw commented 11 months ago

This issue has been already fixed on master.