Skip to content

fix(procfs): report raw values in parse errors#841

Open
HNO3Miracle wants to merge 1 commit into
prometheus:masterfrom
HNO3Miracle:fix-parse-error-format-strings
Open

fix(procfs): report raw values in parse errors#841
HNO3Miracle wants to merge 1 commit into
prometheus:masterfrom
HNO3Miracle:fix-parse-error-format-strings

Conversation

@HNO3Miracle

@HNO3Miracle HNO3Miracle commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • report the original mountinfo field when mount or parent IDs cannot be parsed
  • report the original network socket field for sequence, port, state, queue, UID, inode, and drop parsing failures
  • add regression coverage for every corrected error path

Why

The existing errors format the parsed integer destination, which is zero-valued when parsing fails. This hides the malformed input from callers. Go 1.26.4 also reports these remaining integer arguments as invalid for the %q format verb during downstream package tests.

This follows up on #832, which fixed the same pattern in net_wireless.go, nfs/parse.go, and proc_cgroup.go but did not cover mountinfo.go or net_ip_socket.go.

Testing

  • make test
  • make lint

Use the original string fields when reporting mountinfo and network socket parsing failures. The parsed integer destinations are zero-valued on errors and hide the malformed input.

Signed-off-by: HNO3Miracle <xiangao.or@isrc.iscas.ac.cn>
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.

1 participant