Update mountinfo parsing#228
Conversation
e6d4797 to
28be974
Compare
|
Hrm not sure that using a regex is the best way. How do the usual linux tools parse this? I'd assume there is some regex-free way to do that. If not, this is fine. |
|
The only code I've found so far was some random Perl code. It splits on spaces, which might be a reasonable way to go. But I thought the regexp would be a little better for validating the contents of the various sections. |
|
I'd argue we don't want to validate this at all. See: http://man7.org/linux/man-pages/man5/proc.5.html
|
|
Ok, I'll re-work this. |
28be974 to
1aa033f
Compare
|
@discordianfish Ok, now it's a bunch of much simpler offsets and loops. Thanks for the suggestion. |
243bccd to
44dcc29
Compare
|
I cleaned up a couple more things, I feel like the optional field parsing is now easier to understand, and less buggy. |
|
Beside that, LGTM |
44dcc29 to
dcef1cf
Compare
|
Ok, I returned the optional field check to ignore not fail. |
* Rework string handling to better loop over values. * Use util.ReadFileNoStat() to instead of a buffered reader. * Add a test for hypens in the mountpoint. Fixes: #225 Signed-off-by: Ben Kochie <superq@gmail.com>
dcef1cf to
7af4b63
Compare
* Rework string handling to better loop over values. * Use util.ReadFileNoStat() to instead of a buffered reader. * Add a test for hypens in the mountpoint. Fixes: prometheus#225 Signed-off-by: Ben Kochie <superq@gmail.com>
Fixes: #225
Signed-off-by: Ben Kochie superq@gmail.com