Bug 1483746

Summary: UTF-8 encoding issues in D-Bus services
Product: Red Hat Enterprise Linux 7 Reporter: Kevin Howell <khowell>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: Jan Stavel <jstavel>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: csnyder, jhnidek, jsefler, jstavel, khowell, redakkan, skallesh
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.20.2-1 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 09:51:13 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 Kevin Howell 2017-08-21 20:40:02 UTC
Description of problem:

ERROR in (PoolAttach-test) (attach_tests.clj:121)
Uncaught exception, not in assertion.
expected: nil
  actual: java.lang.AssertionError: Verification failed: (= stderr "")
	stderr : Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/dbus/service.py", line 707, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "<string>", line 2, in PoolAttach
  File "/usr/lib/python2.7/site-packages/rhsmlib/dbus/util.py", line 43, in dbus_handle_exceptions
    six.reraise(exceptions.RHSM1DBusException, "%s: %s" % (type(e).__name__, str(e)), trace)
  File "/usr/lib/python2.7/site-packages/rhsmlib/dbus/util.py", line 35, in dbus_handle_exceptions
    ret = func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/rhsmlib/dbus/objects/attach.py", line 87, in PoolAttach
    raise dbus.DBusException(str(e))
RHSM1DBusException: com.redhat.RHSM1.Error: UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)


Steps to Reproduce:
1. set system encoding to ja_JP.UTF-8
2. Use D-Bus services to try to attach to a pool.

Actual results:
Attach should succeed.

Expected results:
RHSM1DBusException: com.redhat.RHSM1.Error: UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

Comment 7 Jan Stavel 2017-10-04 12:08:09 UTC
I have verified this bug.

[root@jstavel-rhel7-server-01 ~]# rpm -qa | egrep 'subscription|rhsm|cockpit'
   
   subscription-manager-plugin-container-1.20.1-1.git.73.4b01c26.el7.x86_64
   python-rhsm-1.20.1-1.git.42.4b01c26.el7.x86_64
   python-rhsm-certificates-1.20.1-1.git.42.4b01c26.el7.x86_64
   subscription-manager-initial-setup-addon-1.20.1-1.git.73.4b01c26.el7.x86_64
   cockpit-system-138-9.el7.noarch
   cockpit-dashboard-148-1.el7.x86_64
   subscription-manager-migration-data-2.0.37-1.git.0.d45a6c7.el7.noarch
   subscription-manager-gui-1.20.1-1.git.73.4b01c26.el7.x86_64
   subscription-manager-plugin-ostree-1.20.1-1.git.73.4b01c26.el7.x86_64
   cockpit-bridge-138-9.el7.x86_64
   subscription-manager-1.20.1-1.git.73.4b01c26.el7.x86_64
   subscription-manager-migration-1.20.1-1.git.73.4b01c26.el7.x86_64
   cockpit-ws-138-9.el7.x86_64


systemctl edit rhsm.service

  [Service]
  Environment="LANG=ja_JP.UTF-8"
  Environment="LC_ALL=ja_JP.UTF-8"

systemctl daemon-reload
systemctl restart rhsm.service

subscription-manager register

systemctl restart rhsm.service # the service knows older state. It needs to be refreshed.

 busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Attach com.redhat.RHSM1.Attach AutoAttach 'sa{sv}' Standard 0

   I see s list of subscriptions.

and I see a japaness letters in journalctl.



   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: INFO [rhsm.connection:556] Response: status=200, requestUuid=9022903f-c5cc-4ced-bc7d-59b9fad53f45, request="G
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: INFO [subscription_manager.entcertlib:131] certs updated:
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: 全ての更新: 1
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: 見付かった (ローカル) シリアル # []
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: 予期される (UEP) シリアル# [4528066276740481154]
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: 追加 (新規)
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: [sn:4528066276740481154 (Red Hat Beta,) @ /etc/pki/entitlement/4528066276740481154.pem]
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: [sn:4528066276740481154 (Red Hat Hardware Certification Test Suite,) @ /etc/pki/entitlement/45280662767404811
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: [sn:4528066276740481154 (Red Hat Software Collections Beta (for RHEL Server),) @ /etc/pki/entitlement/4528066
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: [sn:4528066276740481154 (Oracle Java (for RHEL Server),) @ /etc/pki/entitlement/4528066276740481154.pem]
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: [sn:4528066276740481154 (Red Hat Enterprise Linux Server,) @ /etc/pki/entitlement/4528066276740481154.pem]
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: [sn:4528066276740481154 (Red Hat Enterprise Linux Resilient Storage (for RHEL Server),) @ /etc/pki/entitlemen
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: [sn:4528066276740481154 (Red Hat Enterprise Linux High Availability (for RHEL Server),) @ /etc/pki/entitlemen
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: [sn:4528066276740481154 (Red Hat Enterprise Linux Load Balancer (for RHEL Server),) @ /etc/pki/entitlement/45
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: 削除済み (変異品):
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com rhsm-service[12162]: <NONE>
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com subscription-manager[12162]: Added subscription for 'Red Hat Enterprise Linux AS, Standard' contract '11480566'
   10月 04 08:01:01 jstavel-rhel7-server-01.usersys.redhat.com subscription-manager[12162]: Added subscription for product 'Red Hat Beta'

Comment 8 Jan Stavel 2017-10-04 12:59:58 UTC
verified. It works now.

Comment 11 errata-xmlrpc 2018-04-10 09:51:13 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-2018:0681