Glances crashes when mountpoint with non ASCII characters esists #1201

This commit is contained in:
nicolargo 2018-02-25 13:41:02 +01:00
parent 1bc7450e90
commit 856652a5c8
4 changed files with 9 additions and 6 deletions

1
NEWS
View File

@ -40,6 +40,7 @@ Bugs corrected:
* Another encoding issue... With both Python 2 and Python 3 #1197 * Another encoding issue... With both Python 2 and Python 3 #1197
* Glances do not exit when eating 'q' #1207 * Glances do not exit when eating 'q' #1207
* FreeBSD blackhole bug #1202 * FreeBSD blackhole bug #1202
* Glances crashes when mountpoint with non ASCII characters exists #1201
Backward-incompatible changes: Backward-incompatible changes:

View File

@ -19,8 +19,7 @@
"""Disk I/O plugin.""" """Disk I/O plugin."""
import re from glances.compat import b
from glances.timer import getTimeSinceLastUpdate from glances.timer import getTimeSinceLastUpdate
from glances.plugins.glances_plugin import GlancesPlugin from glances.plugins.glances_plugin import GlancesPlugin
@ -191,7 +190,8 @@ class Plugin(GlancesPlugin):
if len(disk_name) > name_max_width: if len(disk_name) > name_max_width:
# Cut disk name if it is too long # Cut disk name if it is too long
disk_name = '_' + disk_name[-name_max_width:] disk_name = '_' + disk_name[-name_max_width:]
msg = '{:{width}}'.format(disk_name, width=name_max_width) msg = '{:{width}}'.format(b(disk_name),
width=name_max_width)
ret.append(self.curse_add_line(msg)) ret.append(self.curse_add_line(msg))
if args.diskio_iops: if args.diskio_iops:
# count # count

View File

@ -21,6 +21,7 @@
import numbers import numbers
from glances.compat import b
from glances.folder_list import FolderList as glancesFolderList from glances.folder_list import FolderList as glancesFolderList
from glances.plugins.glances_plugin import GlancesPlugin from glances.plugins.glances_plugin import GlancesPlugin
@ -115,7 +116,7 @@ class Plugin(GlancesPlugin):
path = '_' + i['path'][-name_max_width + 1:] path = '_' + i['path'][-name_max_width + 1:]
else: else:
path = i['path'] path = i['path']
msg = '{:{width}}'.format(path, msg = '{:{width}}'.format(b(path),
width=name_max_width) width=name_max_width)
ret.append(self.curse_add_line(msg)) ret.append(self.curse_add_line(msg))
try: try:

View File

@ -21,7 +21,7 @@
import operator import operator
from glances.compat import u from glances.compat import u, b
from glances.plugins.glances_plugin import GlancesPlugin from glances.plugins.glances_plugin import GlancesPlugin
import psutil import psutil
@ -230,7 +230,8 @@ class Plugin(GlancesPlugin):
mnt_point = '_' + i['mnt_point'][-name_max_width + 1:] mnt_point = '_' + i['mnt_point'][-name_max_width + 1:]
else: else:
mnt_point = i['mnt_point'] mnt_point = i['mnt_point']
msg = '{:{width}}'.format(mnt_point, width=name_max_width) msg = '{:{width}}'.format(b(mnt_point),
width=name_max_width)
ret.append(self.curse_add_line(msg)) ret.append(self.curse_add_line(msg))
if args.fs_free_space: if args.fs_free_space:
msg = '{:>7}'.format(self.auto_unit(i['free'])) msg = '{:>7}'.format(self.auto_unit(i['free']))