Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Hang on startup during CPU detection due to °C unit in temperature readout #234

Open
gsuberland opened this issue Feb 24, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@gsuberland
Copy link

If the sensors command is not available, the Python get_sensors() function is called instead. That function returns temperature values with "°C" appended:

bashtop/bashtop

Lines 4899 to 4903 in 60f95a1

for name, entries in temps.items():
print(name)
for entry in entries:
print(f'{entry.label or name}: {entry.current}°C (high = {entry.high}°C, crit = {entry.critical}°C)')
print()

However, it seems that the unit is not properly removed from temperature values, causing an error on startup:

/usr/local/bin/bashtop: line 2151: (33°C-20)*100/(cpu[temp_high]-20) : syntax error: invalid arithmetic operator (error token is "°C-20)*100/(cpu[temp_high]-20) ")

This hangs bashtop in a 100% CPU loop, and a second session has to be opened to kill the process.

The error site is:

bashtop/bashtop

Line 2151 in 60f95a1

tmp_temp="$(( (${cpu[temp_${i}]}-20)*100/(cpu[temp_high]-20) ))"

The bug is probably in the Intel CPU package temperature code (and may also exist in the AMD code too), and my guess would be that the trailing unit isn't cut off, but my bash-fu isn't good enough to figure out exactly where the issue arises.

Info:

  • Bashtop version: 0.9.25
  • OS: TrueNAS CORE (FreeBSD 13.1)
  • Psutil version: 5.9.4
  • Bash version: 5.2.15
  • Terminal: PuTTY, invoking bashtop from tcsh 6.22.04
@gsuberland gsuberland added the bug Something isn't working label Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants