question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Linux] Build issue in 5.9.2/5.9.3. No speed_hi in struct ethtool_cmd

See original GitHub issue

Summary

  • OS: Linux CentOS 5
  • Architecture: x86_64
  • Psutil version: 5.9.2/5.9.3
  • Python version: Custom build 3.11.0
  • Type: build issue

Description

On CentOS 5 (yes, I know it’s old) ethtool.h does not have speed_hi in struct ethtool_cmd and it also does not have the inline function ethtool_cmd_speed.

On 5.9.2 I get:

  gcc-4.8 -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=592 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/opt/python3/include/python3.11 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-cpython-311/psutil/_psutil_linux.o
  psutil/_psutil_linux.c: In function ‘psutil_net_if_duplex_speed’:
  psutil/_psutil_linux.c:444:9: warning: implicit declaration of function ‘ethtool_cmd_speed’ [-Wimplicit-function-declaration]
           uint_speed = ethtool_cmd_speed(&ethcmd);
           ^

On 5.9.3 I get:

3.11 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-cpython-311/psutil/_psutil_linux.o
  psutil/_psutil_linux.c: In function ‘psutil_ethtool_cmd_speed’:
  psutil/_psutil_linux.c:79:17: error: ‘const struct ethtool_cmd’ has no member named ‘speed_hi’
       return (ecmd->speed_hi << 16) | ecmd->speed;

Version 5.9.1 is fine.

Thanks

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
giampaolocommented, Nov 10, 2022

Not bad. Most (all) of these are test adjustments which would need fixing on centos 5, but they don’t mean the underlying functionality is broken. CentOS 5 appears fully supported.

0reactions
lmunchcommented, Nov 10, 2022

Ok, here we go. This is running in a CentOS 5 container:

======================================================================
ERROR: psutil.tests.test_linux.TestProcess.test_status_file_parsing
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/psutil/psutil/tests/test_linux.py", line 2178, in test_status_file_parsing
    self.assertEqual(p._proc._get_eligible_cpus(), list(range(0, 8)))
AttributeError: 'Process' object has no attribute '_get_eligible_cpus'

======================================================================
ERROR: psutil.tests.test_linux.TestProcessAgainstStatus.test_cpu_affinity
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/psutil/psutil/tests/test_linux.py", line 2258, in test_cpu_affinity
    self.proc.cpu_affinity(), list(range(min_, max_ + 1)))
AttributeError: 'Process' object has no attribute 'cpu_affinity'

======================================================================
ERROR: psutil.tests.test_linux.TestProcessAgainstStatus.test_cpu_affinity_eligible_cpus
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/psutil/psutil/tests/test_linux.py", line 2263, in test_cpu_affinity_eligible_cpus
    self.proc._proc._get_eligible_cpus()
AttributeError: 'Process' object has no attribute '_get_eligible_cpus'

======================================================================
FAIL: psutil.tests.test_contracts.TestAvailConstantsAPIs.test_rlimit
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/psutil/psutil/tests/test_contracts.py", line 99, in test_rlimit
    ae(hasattr(psutil, "RLIM_INFINITY"), LINUX or FREEBSD)
AssertionError: False != True

======================================================================
FAIL: psutil.tests.test_contracts.TestAvailProcessAPIs.test_cpu_affinity
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/psutil/psutil/tests/test_contracts.py", line 188, in test_cpu_affinity
    self.assertEqual(hasattr(psutil.Process, "cpu_affinity"),
AssertionError: False != True

======================================================================
FAIL: psutil.tests.test_contracts.TestAvailProcessAPIs.test_rlimit
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/psutil/psutil/tests/test_contracts.py", line 175, in test_rlimit
    self.assertEqual(hasattr(psutil.Process, "rlimit"), LINUX or FREEBSD)
AssertionError: False != True

======================================================================
FAIL: psutil.tests.test_system.TestMiscAPIs.test_users
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/psutil/psutil/tests/test_system.py", line 206, in test_users
    self.assertNotEqual(users, [])
AssertionError: [] == []

======================================================================
FAIL: psutil.tests.test_misc.TestScripts.test_who
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/psutil/psutil/tests/test_misc.py", line 781, in test_who
    self.assert_stdout('who.py')
  File "/psutil/psutil/tests/test_misc.py", line 734, in assert_stdout
    assert out, out
AssertionError

======================================================================
FAIL: psutil.tests.test_testutils.TestMemLeakClass.test_leak_mem
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/psutil/psutil/tests/__init__.py", line 723, in wrapper
    raise exc
  File "/psutil/psutil/tests/__init__.py", line 715, in wrapper
    return fun(*args, **kwargs)
  File "/psutil/psutil/tests/test_testutils.py", line 379, in test_leak_mem
    self.assertRaisesRegex(AssertionError, "extra-mem",
AssertionError: AssertionError not raised by execute

======================================================================
FAIL: psutil.tests.test_linux.TestRootFsDeviceFinder.test_comparisons
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/psutil/psutil/tests/test_linux.py", line 1331, in test_comparisons
    self.assertIsNotNone(finder.find())
AssertionError: unexpectedly None

======================================================================
FAIL: psutil.tests.test_linux.TestRootFsDeviceFinder.test_disk_partitions_mocked
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/psutil/psutil/tests/test_linux.py", line 1363, in test_disk_partitions_mocked
    self.assertNotEqual(part.device, "/dev/root")
AssertionError: '/dev/root' == '/dev/root'

----------------------------------------------------------------------
Ran 637 tests in 3.613s

FAILED (failures=8, errors=3, skipped=163)
FAILED
make: *** [test] Error 1
Read more comments on GitHub >

github_iconTop Results From Across the Web

ethtool/ethtool_cmd.go at master · safchain/ethtool - GitHub
A simple ethtool "like" library for GO. Contribute to safchain/ethtool development by creating an account on GitHub.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found