]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lscpu: cure empty output of lscpu -b/-p
authorJan Engelhardt <jengelh@inai.de>
Thu, 18 Jan 2024 00:50:01 +0000 (00:50 +0000)
committerKarel Zak <kzak@redhat.com>
Tue, 23 Jan 2024 10:18:31 +0000 (11:18 +0100)
commitcd9c4cac3d7c7969c6ca7f063cef42e862ce98a7
tree904e2f0b85df54b535950511ecc37801b7babbe2
parentbe7a2d9e6d626e8ee8b936e5330e4ce87e66b21d
lscpu: cure empty output of lscpu -b/-p

On riscv, /proc/cpuinfo looks like:

processor       : 3
hart            : 4
isa             : rv64imafdc_zicntr_zicsr_zifencei_zihpm_zba_zbb
mmu             : sv39
uarch           : sifive,u74-mc
mvendorid       : 0x489
marchid         : 0x8000000000000007
mimpid          : 0x4210427
hart isa        : rv64imafdc_zicntr_zicsr_zifencei_zihpm_zba_zbb

As none of the cputype_patterns match any of the fields in that file,
`cpu->type` is never set, which causes `get_cell_data` to always
return nullptr. The output of `lscpu -b --extended=CPU` and `lscpu
-p` is then empty.

Resolve that.

[kzak@redhat.com: - fix DEF_PAT_CPUTYPE()s order
                  - refresh lscpu/lscpu-rv64-linux test]

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-cputype.c
tests/expected/lscpu/lscpu-rv64-linux