Bug 919584

Summary: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
Product: Red Hat Enterprise Linux 5 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Alex Wood <awood>
Status: CLOSED ERRATA QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.10CC: awood, jdornak, jgalipea, lmiksik, tstrachota
Target Milestone: beta   
Target Release: 5.10   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
No description necessary
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-30 22:58:49 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: 840995, 920191, 928849    

Description John Sefler 2013-03-08 19:52:13 UTC
Description of problem:
subscription-manager-1.8 register attempt with invalid credentials throws traceback UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)


Version-Release number of selected component (if applicable):
[root@rhsm-compat-rhel59 ~]# rpm -q subscription-manager
subscription-manager-1.8.3-1.git.142.897941f.el5


How reproducible:


Steps to Reproduce:
[root@rhsm-compat-rhel59 ~]# LANG=de_DE.UTF-8 subscription-manager register --username=foo --password=bar
'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)

  

Additional info:

[root@rhsm-compat-rhel59 ~]# tail -f /var/log/rhsm/rhsm.log
2013-03-08 14:49:53,958 [DEBUG]  @connection.py:415 - Making request: GET /candlepin/users/foo/owners
2013-03-08 14:49:53,990 [DEBUG]  @connection.py:434 - Response status: 401
2013-03-08 14:49:53,992 [ERROR]  @managercli.py:143 - exception caught in subscription-manager
2013-03-08 14:49:53,992 [ERROR]  @managercli.py:144 - 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 87, in ?
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 78, in main
    return managercli.ManagerCLI().main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 2167, in main
    return CLI.main(self)
  File "/usr/share/rhsm/subscription_manager/cli.py", line 160, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 472, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1062, in _do_command
    systemExit(-1, re.msg)
  File "/usr/share/rhsm/subscription_manager/cli.py", line 187, in systemExit
    sys.stderr.write("%s\n" % msg)
  File "/usr/lib64/python2.4/codecs.py", line 178, in write
    data, consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)

Comment 1 Alex Wood 2013-03-22 18:27:18 UTC
This bug is actually caused by a fix for bug 800323 (commit 056e69dc833919709bbf23d8a7b73a5345f77fdf).  In my opinion, this bug is more serious than an error when running subscription-manager in a sub-shell, so I'm going to revert the earlier fix.  Additionally, I was unable to reproduce the error described in bug 800323 after having reverted the fix.

Comment 2 John Sefler 2013-03-22 19:11:23 UTC
Also note on RHEL5 only: this same 'ascii' codec is thrown when subscription names contain international chars which causes subscription-manager --list commands to abort (same behavior as bug 880070).

Comment 4 RHEL Program Management 2013-04-09 19:04:20 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 5 Bryan Kearney 2013-04-29 14:57:24 UTC
*** Bug 862174 has been marked as a duplicate of this bug. ***

Comment 6 John Sefler 2013-05-28 14:56:02 UTC
Verifying Version...
[root@jsefler-5 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 0.8.7-1
subscription-manager: 1.8.8-1.el5
python-rhsm: 1.8.11-1.el5


[root@jsefler-5 ~]# LANG=de_DE.UTF-8 subscription-manager register --username=foo --password=bar
Ungültige Berechtigungnachweise

VERIFIED: we can now register without hitting the UnicodeDecodeError



[root@jsefler-5 ~]# LANG=de_DE.UTF-8 subscription-manager register --username=testuser1
Passwort: 
Organisation: admin
Das System wurde mit folgender ID registriert: 7e4eca9f-06d3-4ea7-89c9-7d8d0e20324b 
[root@jsefler-5 ~]# LANG=de_DE.UTF-8 subscription-manager list --available --all
+-------------------------------------------+
    Verfügbare Subskriptionen
+-------------------------------------------+
Subskriptionsname:  Subscription name containing UTF–8 character \u2013
SKU:                utf8-subscription-sku
Pool-ID:            8a90f8df3ee7138f013eeb915def1188
Anzahl:             20
Service-Level:      
Service-Typ:        
Multi-Berechtigung: No
Endet:              12.06.2013
System-Typ:         Physisch

VERIFIED: a subscription whose name contains a utf character also displays properly


Moving status to VERIFIED

Comment 7 John Sefler 2013-05-28 15:06:09 UTC
(In reply to Alex Wood from comment #1)
> This bug is actually caused by a fix for bug 800323 (commit
> 056e69dc833919709bbf23d8a7b73a5345f77fdf).  In my opinion, this bug is more
> serious than an error when running subscription-manager in a sub-shell, so
> I'm going to revert the earlier fix.  Additionally, I was unable to
> reproduce the error described in bug 800323 after having reverted the fix.

Actually, I *was* able to reproduce the error described in bug 800323 now that the fix for bug 800323 has been reverted.  Here's my re-create...

[root@jsefler-5 ~]# subscription-manager list --available --all | grep utf8
'ascii' codec can't encode character u'\u2013' in position 51: ordinal not in range(128)

where the offending character in position 51 was successfully displayed in comment 6; yet piping the output through grep as a subshell throws the error.

Subskriptionsname:  Subscription name containing UTF–8 character \u2013
                                                    ^
                                                    ^
                                                    ^ offending position 51

Comment 9 errata-xmlrpc 2013-09-30 22:58:49 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.

http://rhn.redhat.com/errata/RHBA-2013-1332.html