Bug 21964 - glances crashes in glances_hddtemp.py plugin
Summary: glances crashes in glances_hddtemp.py plugin
Status: RESOLVED OLD
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 6
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-29 23:52 CET by Benoît Audouard
Modified: 2020-08-02 13:25 CEST (History)
5 users (show)

See Also:
Source RPM: glances-2.6.1-1.mga6.src.rpm
CVE:
Status comment:


Attachments

Description Benoît Audouard 2017-10-29 23:52:56 CET
glances crashes in mga6 when launched on my laptop due to glances_hddtemp.py plugin (upstream bug #824 fixed in latest version)

To reproduce :
[root@zenbaud ~]# glances 
Traceback (most recent call last):
  File "/usr/bin/glances", line 9, in <module>
    load_entry_point('Glances==2.6.1', 'console_scripts', 'glances')()
  File "/usr/lib/python3.5/site-packages/glances/__init__.py", line 133, in main
    standalone.serve_forever()
  File "/usr/lib/python3.5/site-packages/glances/standalone.py", line 107, in serve_forever
    return self.__serve_forever()
  File "/usr/lib/python3.5/site-packages/glances/standalone.py", line 88, in __serve_forever
    self.stats.update()
  File "/usr/lib/python3.5/site-packages/glances/stats.py", line 154, in update
    self._plugins[p].update()
  File "/usr/lib/python3.5/site-packages/glances/plugins/glances_hddtemp.py", line 62, in update
    self.stats = self.glancesgrabhddtemp.get()
  File "/usr/lib/python3.5/site-packages/glances/plugins/glances_hddtemp.py", line 145, in get
    self.__update__()
  File "/usr/lib/python3.5/site-packages/glances/plugins/glances_hddtemp.py", line 122, in __update__
    hddtemp_current['value'] = float(temperature) if temperature != b'ERR' else temperature
ValueError: could not convert string to float: b'NOS'



This has been identified in upstream bug https://github.com/nicolargo/glances/issues/824
and corrected in source code https://github.com/nicolargo/glances/blob/master/glances/plugins/glances_hddtemp.py



Using the latest version of this file source code introduces other problems, so I simply patched it :

diff -Naur glances_hddtemp.py.orig glances_hddtemp.py
--- glances_hddtemp.py.orig	2017-10-29 23:12:45.281986191 +0100
+++ glances_hddtemp.py	2017-10-29 22:12:01.378480977 +0100
@@ -119,7 +119,7 @@
             temperature = fields[offset + 3]
             unit = nativestr(fields[offset + 4])
             hddtemp_current['label'] = device
-            hddtemp_current['value'] = float(temperature) if temperature != b'ERR' else temperature
+            hddtemp_current['value'] = float(temperature) if (temperature != b'ERR' and temperature != b'NOS') else temperature
             hddtemp_current['unit'] = unit
             self.hddtemp_list.append(hddtemp_current)


I tried to install the noarch rpm from cauldron with no success as cauldron has moved to python3.6 (python3.5 in mga6) :

rpm -ivh glances-2.10-2.mga7.noarch.rpm 
erreur : Dépendances requises:
	python(abi) = 3.6 est nécessaire pour glances-2.10-2.mga7.noarch

So, I rebuilt the src.rpm for mga6 from cauldron's src.rpm glances-2.10-2.mga7.src.rpm so that I obtained glances-2.10-2.mga6.noarch.rpm from your package source: at least it works for me.

I did not follow the suggestion of the upstream developer to do use pip:
You are using Glances version 2.10, however version 2.11.1 is available.
You should consider upgrading using: pip install --upgrade glances
[

Would you consider backporting your current cauldron package to mga6 to fix the bug? Even better would be to bounce the version by rebuilding it in mga6 so that it's available in release.
Comment 1 Benoît Audouard 2017-10-30 00:10:50 CET
I saw in the changelog that shlomif bumped the version of the package to 2.10 and pterjan applied mass rebuild for python3.6, that's why I'm CCing them ;-)

CC: (none) => pterjan, shlomif

Comment 2 Shlomi Fish 2017-10-30 08:44:12 CET
(In reply to Benoît Audouard from comment #0)
> glances crashes in mga6 when launched on my laptop due to glances_hddtemp.py
> plugin (upstream bug #824 fixed in latest version)
> 
> To reproduce :
> [root@zenbaud ~]# glances 
> Traceback (most recent call last):
>   File "/usr/bin/glances", line 9, in <module>
>     load_entry_point('Glances==2.6.1', 'console_scripts', 'glances')()
>   File "/usr/lib/python3.5/site-packages/glances/__init__.py", line 133, in
> main

This command works fine as root or as my default user on my mageia v6 x86-64 VBox VM. How should we reproduce it exactly?
Comment 3 Benoît Audouard 2017-10-30 22:17:37 CET
> How should we reproduce it exactly?

use a laptop, not a VM ;-)

with a laptop hddtemp plugin is called, then you get the actual error which is the latest in the stack trace :

>   File "/usr/lib/python3.5/site-packages/glances/plugins/glances_hddtemp.py", line 122, in __update__
>    hddtemp_current['value'] = float(temperature) if temperature != b'ERR' else temperature
> ValueError: could not convert string to float: b'NOS'


hence, the reason why, in order to debug it/make it work, I had to add the test != b'NOS' (unexpected and unmanaged value in the source code)
Marja Van Waes 2017-10-31 10:20:46 CET

CC: (none) => marja11
Assignee: bugsquad => shlomif

Comment 4 Pascal Terjan 2017-10-31 10:44:42 CET
This seems fixed upstream https://github.com/nicolargo/glances/blob/master/glances/plugins/glances_hddtemp.py#L128
Comment 5 papoteur 2018-07-13 19:29:50 CEST
Hello,
This bug is persistent. See https://www.mageialinux-online.org/forum/topic-25289-0-241884+glances.php
I think that a update is needed for Mga6

CC: (none) => yves.brungard_mageia

Comment 6 Lewis Smith 2019-12-02 19:51:17 CET
@ Benoît
Sorry to have left you on this; Mageia 6 is by now no longer supported.
Can you say whether you have the problem with Mageia 7?

Assignee: shlomif => bugsquad
CC: (none) => lewyssmith

Comment 7 Marja Van Waes 2020-08-02 13:25:27 CEST
(In reply to Lewis Smith from comment #6)
> @ Benoît
> Sorry to have left you on this; Mageia 6 is by now no longer supported.
> Can you say whether you have the problem with Mageia 7?

No reply and since pterjan mentioned in 2017 that it was fixed upstream, we should have the fixed version in Mageia 7

So closing as OLD

Resolution: (none) => OLD
Status: NEW => RESOLVED


Note You need to log in before you can comment on or make changes to this bug.