cpu: handle vendor suffixes in parseRelease

Kernel release strings such as "3.4.35_hi3535" on some Synology devices
failed to parse because only dash and plus suffixes were stripped.
Parse the leading digits of each component instead, mirroring the Go
runtime fix.

This copies the implementation from the Go runtime's parseRelease as
updated in CL 781800.

Fixes golang/go#80094

Co-authored-by: Brad Fitzpatrick <bradfitz@golang.org>
Change-Id: I41f8fd0a1d6c012eebd5368e623b42e99220d1a3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/793760
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2 files changed
tree: d48eec347dfb4594cf3773c26a6c12bf02353bea
  1. cpu/
  2. execabs/
  3. plan9/
  4. unix/
  5. windows/
  6. .gitattributes
  7. .gitignore
  8. codereview.cfg
  9. CONTRIBUTING.md
  10. go.mod
  11. LICENSE
  12. PATENTS
  13. README.md
README.md

sys

Go Reference

This repository holds supplemental Go packages for low-level interactions with the operating system.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://go.dev/doc/contribute.

The git repository is https://go.googlesource.com/sys.

The main issue tracker for the sys repository is located at https://go.dev/issues. Prefix your issue with “x/sys:” in the subject line, so it is easy to find.