Bug 1679591

Summary: ssm: unhandled exception for some locales set through LC_ALL
Product: Red Hat Enterprise Linux 7 Reporter: Jan Tulak <jtulak>
Component: system-storage-managerAssignee: Lukáš Czerner <lczerner>
Status: CLOSED ERRATA QA Contact: Boyang Xue <bxue>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.7CC: agk, lczerner, prajnoha, rhandlin, xzhou, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 12:55:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Tulak 2019-02-21 13:37:29 UTC
Description of problem:
When LC_ALL is set to a locale with different decimal character than dot "." (e.g. cs_CZ.UTF-8), ssm crashes.

# ssm list
Traceback (most recent call last):
File "/usr/bin/ssm", line 48, in 
sys.exit(main.main())
File "/usr/lib/python2.7/site-packages/ssmlib/main.py", line 2110, in main
args.func(args)
File "/usr/lib/python2.7/site-packages/ssmlib/main.py", line 1339, in list
self.dev.ptable()
File "/usr/lib/python2.7/site-packages/ssmlib/main.py", line 639, in ptable
item = misc.humanize_size(data[attr])
File "/usr/lib/python2.7/site-packages/ssmlib/misc.py", line 444, in humanize_size
size = float(arg)
ValueError: invalid literal for float(): 148631552,00
[root@a2s-server-test ~]# uname -a
Linux ##################### 3.10.0-957.1.3.el7.x86_64 #1 SMP Thu Nov 29 14:49:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@a2s-server-test ~]# ssm --version
0.4


Version-Release number of selected component (if applicable):
This issue is present from the beginning, this is not a regression.

How reproducible:
Every time

Steps to Reproduce:
$ export LC_ALL="cs_CZ.UTF-8"
$ sudo ssm list

Actual results:
ssm crashes with an unhandle ValueError: invalid literal for float()

Expected results:
ssm does the same thing as with LC_ALL='C'


Additional info:
The simplest fix is to run all the tools from ssm with LC_ALL='C'. This will ignore the user-set preference for localization, but as SSM does not support localization at all, this is not an issue. Furthermore, ssm already overwrites LC_NUMERIC. This can be changed to LC_ALL to fix this issue.

This issue was not noticed before probably because users with different locale usually used individual LC_* variables and for that case ssm already had a solution.

Comment 1 Jan Tulak 2019-02-22 15:55:24 UTC
Patch is available in upstream, I'm adding it to the current release.

Comment 9 errata-xmlrpc 2019-08-06 12:55:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2133