Bug 1840142

Summary: python-dateutil from openstack-16-tools-for-rhel-8-x86_64-rpms repo triggers UnicodeWarning
Product: Red Hat Enterprise Linux 8 Reporter: David Juran <djuran>
Component: rpmAssignee: Michal Domonkos <mdomonko>
Status: CLOSED ERRATA QA Contact: Jan Blazek <jblazek>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 8.2CC: gmartins, jalviso, lbalhar, mdomonko, pmatilai, pviktori, torsava, vstinner
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.14.3-16.el8 Doc Type: Bug Fix
Doc Text:
Cause: The user updates python3-dateutil to version 2.8. This could happen as part of a regular "dnf update" when subscribed to the OpenStack channels. Note that this version of python3-dateutil is not available in RHEL 8.5 (which only ships with version 2.6); it's only available in the RHOSP (Red Hat OpenStack Platform) repositories. So basically, while most RHEL customers are unlikely to hit this bug, RHOSP customers may (and do, see the attached customer cases). Consequence: After the above update, whenever DNF is used, it may print the following warning: "UnicodeWarning: decode() called on unicode string". Fix: The warning, which was harmless, has been removed, as it was no longer deemed necessary. Result: DNF no longer prints the warning. Note: I intentionally didn't mention that the warning comes in fact from RPM; I consider that an implementation detail. Most users would encounter this issue through the use of DNF. However, if you think we should mention RPM after all (e.g. due to the fact that it's released in an RPM advisory), let me know and I'll rephrase.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 20:01:59 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 David Juran 2020-05-26 13:06:25 UTC
Description of problem:
After enabling the openstack-16-tools-for-rhel-8-x86_64-rpms repo, python-datutil started triggering an ugly warning

Version-Release number of selected component (if applicable):
python3-dateutil-2.8.0-1.el8ost.noarch

How reproducible:


Steps to Reproduce:
1. sudo dnf provides /usr/bin/openstack
Updating Subscription Management repositories.
/usr/lib/python3.6/site-packages/dateutil/parser/_parser.py:70: UnicodeWarning: decode() called on unicode string, see https://bugzilla.redhat.com/show_bug.cgi?id=1693751
  instream = instream.decode()

Last metadata expiration check: 0:01:04 ago on Tue 26 May 2020 15:56:02 EEST.
python3-openstackclient-4.0.0-0.20191025160014.aa64eb6.el8ost.noarch : OpenStack Command-line Client
Repo        : openstack-16-tools-for-rhel-8-x86_64-rpms
Matched from:
Filename    : /usr/bin/openstack

Comment 7 Lumír Balhar 2020-06-22 14:05:01 UTC
It might be also a good idea to fix dateutil to do the same for both Pythons (use .decode() only for bytes and bytearray) so from:

def __init__(self, instream):
    if six.PY2:
        # In Python 2, we can't duck type properly because unicode has
        # a 'decode' function, and we'd be double-decoding
        if isinstance(instream, (bytes, bytearray)):
            instream = instream.decode()
    else:
        if getattr(instream, 'decode', None) is not None:
            instream = instream.decode()

to

def __init__(self, instream):
    if isinstance(instream, (bytes, bytearray)):
        instream = instream.decode()

I'm gonna try to propose that upstream.

Comment 8 Lumír Balhar 2020-06-22 15:29:46 UTC
Upstream dateutil PR: https://github.com/dateutil/dateutil/pull/1060

Comment 9 Petr Viktorin (pviktori) 2020-07-01 12:14:50 UTC
Hello, RPM maintainers.
The "temporary patch" in https://src.osci.redhat.com/rpms/rpm/blob/rhel-8.3.0/f/0001-Monkey-patch-.decode-method-to-our-strings-as-a-temp.patch
is changing behavior of Python's str type, which can break other software.
Are there any plans to remove it?

Comment 18 Radek Bíba 2020-11-18 13:02:31 UTC
*** Bug 1894349 has been marked as a duplicate of this bug. ***

Comment 35 errata-xmlrpc 2021-11-09 20:01:59 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 (Low: rpm security, 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/RHSA-2021:4489