Skip to content

Values containing colon (:) in /proc/cpuinfo are truncated (affects Hygon CPUs) #440

@kuro5989

Description

@kuro5989

When parsing /proc/cpuinfo, ghw uses strings.Split(line, ":") to separate key : value and directly takes parts[1] as the value.

If the value itself contains a colon (:), everything after the first colon in the value is ignored, resulting in truncated fields.

This issue can be reliably reproduced on Hygon CPUs.

Environment:

CPU: Hygon C86-4G

OS: Linux

ghw: 0.21.2

Reproduction example:

Excerpt from /proc/cpuinfo:

model name : Hygon C86-4G (OPN:7470)

Image

Current ghw parsing result:

model name = "Hygon C86-4G (OPN"

Expected result:

model name = "Hygon C86-4G (OPN:7470)"

Root cause:

The relevant code:

parts := strings.Split(line, ":")

When the value contains a colon (e.g., OPN:7470), strings.Split produces multiple elements, but ghw only uses parts[1], discarding the remainder.

Notes:

This is a general parsing bug, not a vendor-specific exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions