Bug 972703

Summary: qpid-stat UnicodeEncodeError if output redirected.
Product: Red Hat Enterprise MRG Reporter: Leonid Zhaldybin <lzhaldyb>
Component: qpid-toolsAssignee: messaging-bugs <messaging-bugs>
Status: NEW --- QA Contact: Messaging QE <messaging-qe-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: DevelopmentCC: jross
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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 Leonid Zhaldybin 2013-06-10 12:37:58 UTC
Description of problem:
After bug 841488 was fixed in 2.2 release, qpid-stat tool is capable of displaying entities with non-ASCII (UTF-8) names, for example:

[root@lzhaldyb-rhel64x ~]# qpid-config add queue тест
[root@lzhaldyb-rhel64x ~]# qpid-stat -q
Queues
  queue                                     dur  autoDel  excl  msg   msgIn  msgOut  bytes  bytesIn  bytesOut  cons  bind
  =========================================================================================================================
  1a304d39-60c0-4bef-b29b-7afeb4ad2cd2:0.0       Y        Y        0     0      0       0      0        0         1     2
  тест

However, putting the qpid-stat output through pipe results in the following error:

[root@lzhaldyb-rhel64x ~]# qpid-stat -q | cat
Queues
  queue                                     dur  autoDel  excl  msg   msgIn  msgOut  bytes  bytesIn  bytesOut  cons  bind
  =========================================================================================================================
  b1156582-a01c-485a-aded-1062aa5954b9:0.0       Y        Y        0     0      0       0      0        0         1     2
Failed: UnicodeEncodeError - 'ascii' codec can't encode characters in position 2-5: ordinal not in range(128)

This makes impossible parsing of qpid-stat provided information on queues and exchanges in bash scripts or using grep to select the entity we are currently interested in.

Version-Release number of selected component (if applicable):
qpid-tools-0.22-2

How reproducible:
100%

Steps to Reproduce:
1. Create a queue or an exchange with non-ASCII characters in the name.
2. Get its statistics using qpid-stat tool.
3. Redirect qpid-stat output to a pipe or an ordinary file.

Actual results:
UnicodeEncodeError in the resulting output.

Expected results:
No encode errors.

Additional info:
qpid-config tools does not suffer from this particular problem:

[root@lzhaldyb-rhel64x ~]# qpid-config queues | cat
Queue Name                                Attributes
=================================================================
589227ec-0446-4b81-ada0-acfbe53342cd:0.0  auto-del excl 
тест                                  
[root@lzhaldyb-rhel64x ~]# echo $?
0

The stable (2.3) version behavior is exactly the same, so this is not a regression.

Comment 1 Leonid Zhaldybin 2014-05-15 12:30:57 UTC
*** Bug 913822 has been marked as a duplicate of this bug. ***