One function

_get_cpu_info_from_ibm_pa_features in workhorsy/py-cpuinfo

The author described this change as Fixed Bug #68: Broken Qemu guest CPU flag parsing on Ubuntu 17.10 POWER8. It counts as a record because the check below fails on the code as it stood at d7f2b7eba and passes on ab82d69ac, with nothing else changed between the two runs.

Fix saved2017-04-19
Sharing licenceMIT · LICENSE
Change size+8 4

What the code was meant to do, written into the code itself as a docstring

Returns the CPU info gathered from lsprop /proc/device-tree/cpus/*/ibm,pa-features Returns {} if lsprop is not found or ibm,pa-features does not have the desired info.

The change

1212 if output == None or returncode != 0:
1313 return {}
1414
15- value = output.split("ibm,pa-features")[1].strip()
16- left, right = value.split(' ')
17- left = int(left, 16)
18- right = int(right, 16)
15+ # Filter out invalid characters from output
16+ value = output.split("ibm,pa-features")[1].lower()
17+ value = [s for s in value if s in list('0123456789abcfed')]
18+ value = ''.join(value)
19+
20+ # Get data converted to Uint32 chunks
21+ left = int(value[0 : 8], 16)
22+ right = int(value[8 : 16], 16)
1923
2024 # Get the CPU flags
2125 flags = {

The check that tells the two apart

failpass·tests/test_linux_debian_8_7_1_ppc64le.py::TestLinuxDebian_8_7_1_ppc64le::test_all

Check file tests/test_linux_debian_8_7_1_ppc64le.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itd7f2b7eba653192047f662f95be462d543b06244
Broken version dated2017-04-19
Modulecpuinfo.cpuinfo
Units changed_get_cpu_info_from_ibm_pa_features
Fingerprint212e7fd77819f5ae
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in workhorsy/py-cpuinfo