Bug 1880031

Summary: libblockdev doesn't run external utilities with LC_ALL=C and fails to parse their localized output
Product: Red Hat Enterprise Linux 8 Reporter: Vojtech Trefny <vtrefny>
Component: libblockdevAssignee: Vojtech Trefny <vtrefny>
Status: CLOSED ERRATA QA Contact: guazhang <guazhang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: guazhang
Target Milestone: rcKeywords: ZStream
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libblockdev-2.24-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1895286 (view as bug list) Environment:
Last Closed: 2021-05-18 15:42:31 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:
Bug Depends On:    
Bug Blocks: 1895286    

Description Vojtech Trefny 2020-09-17 14:53:18 UTC
We expect output of external utilities such as mkswap to be in English, but due to a bug in the libblockdev code, we do not run these with LC_ALL=C and on systems with non-English locale we fail to parse the localized output.
See the upstream fix for more details: https://github.com/storaged-project/libblockdev/pull/544

This bug was introduced in 2.24 available since 8.3

Simple reproducer:

with default/C locale:
$ sudo LC_ALL=C python3
>>> from gi.repository import BlockDev
>>> BlockDev.utils_check_util_version("mkswap", "2.23", "--version", "mkswap from util-linux ([\\d\\.]+)")
True

with different locale:
$ sudo LC_ALL=cs_CZ.UTF-8 python3
>>> from gi.repository import BlockDev
>>> BlockDev.utils_check_util_version("mkswap", "2.23", "--version", "mkswap from util-linux ([\\d\\.]+)")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
GLib.Error: g-bd-utils-exec-error-quark: Failed to determine mkswap's version from: mkswap z util-linux 2.32.1
 (4)

Comment 2 guazhang@redhat.com 2020-11-04 01:00:24 UTC
Hi,

which libblockdev will fix the issue ? we will start the testing because the ITM set 1.

Comment 3 guazhang@redhat.com 2020-11-04 06:22:17 UTC
Hello

Can not reproduce the bug with libblockdev-2.24-1.el8.x86_64, Could you help to check if something is wrong ?

[root@storageqe-70 ~]# sudo LC_ALL=C python3
Python 3.6.8 (default, Aug 18 2020, 08:33:21) 
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import BlockDev
__main__:1: PyGIWarning: BlockDev was imported without specifying a version first. Use gi.require_version('BlockDev', '2.0') .
>>> BlockDev.utils_check_util_version("mkswap", "2.23", "--version", "mkswap from util-linux ([\\d\\.]+)")
True
>>> 
[root@storageqe-70 ~]# sudo LC_ALL=cs_CZ.UTF-8 python3
Python 3.6.8 (default, Aug 18 2020, 08:33:21) 
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import BlockDev
__main__:1: PyGIWarning: BlockDev was imported without specifying a version first. Use gi.require_version('BlockDev', '2.0') .
>>> BlockDev.utils_check_util_version("mkswap", "2.23", "--version", "mkswap from util-linux ([\\d\\.]+)")
True
>>> 
[root@storageqe-70 ~]# 

[root@storageqe-70 ~]# rpm -qa |grep libblock
libblockdev-utils-2.24-1.el8.x86_64
libblockdev-2.24-1.el8.x86_64
[root@storageqe-70 ~]#

Comment 4 Vojtech Trefny 2020-11-05 08:22:42 UTC
(In reply to guazhang from comment #2)
> Hi,
> 
> which libblockdev will fix the issue ? we will start the testing because the
> ITM set 1.

2.24-2, I'm waiting for the RHEL 8.4 dist-git branch to be created and I'll do a build as soon as possible (DevTestDoc phase starts on Monday 2020-11-09 so I should be able to do the build on Monday).
I'm still new to this ITM concept, so if you think we should wait a little more or if you need more time for testing, feel free to move ITM to 2 or 3.

(In reply to guazhang from comment #3)
> Hello
> 
> Can not reproduce the bug with libblockdev-2.24-1.el8.x86_64, Could you help
> to check if something is wrong ?
> 

Make you sure you have "glibc-langpack-cs" installed.

Comment 5 guazhang@redhat.com 2020-11-05 08:40:14 UTC
Hi,

Yes, hit it after installed glibc-langpack-cs, and will move ITM to 3.

[root@storageqe-69 ~]# LC_ALL=cs_CZ.UTF-8 python3
Python 3.6.8 (default, Aug 18 2020, 08:33:21) 
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import BlockDev
__main__:1: PyGIWarning: BlockDev was imported without specifying a version first. Use gi.require_version('BlockDev', '2.0') before import to ensure that the right version gets loaded.
>>> BlockDev.utils_check_util_version("mkswap", "2.23", "--version", "mkswap from util-linux ([\\d\\.]+)")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
GLib.Error: g-bd-utils-exec-error-quark: Failed to determine mkswap's version from: mkswap z util-linux 2.32.1
 (4)
>>> 
[root@storageqe-69 ~]# rpm -qa | grep libblock
libblockdev-utils-2.24-1.el8.x86_64
libblockdev-2.24-1.el8.x86_64
[root@storageqe-69 ~]# rpm -qa | grep glibc-langpack-cs
glibc-langpack-cs-2.28-136.el8.x86_64
[root@storageqe-69 ~]#

Comment 11 guazhang@redhat.com 2020-11-12 02:44:49 UTC
Hi

Test pass with package libblockdev-2.24-2.el8.x86_64, move to verified.

Comment 13 errata-xmlrpc 2021-05-18 15:42:31 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 (libblockdev bug fix and enhancement update), 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-2021:1820