Bug 672171

Summary: Pulp server cannot process a repo with name encoded in unicode
Product: [Retired] Pulp Reporter: Lukas Zapletal <lzap>
Component: z_otherAssignee: Lukas Zapletal <lzap>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedKeywords: Triaged
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: 2011-08-15 15:14:54 UTC Type: ---
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: 647488    
Attachments:
Description Flags
Solution A patch none

Description Lukas Zapletal 2011-01-24 09:49:33 UTC
Description of problem:

Unable to create a repo with unicode characters.

Steps to Reproduce:
1. pulp-admin repo create --arch=x86_64 --feed yum:http://download.fedora.redhat.com/pub/fedora/linux/updates/13/x86_64/ --name="Příliš žluťoučký kůŇ úpěl Ďábelské ódy" --id=fedora-repo-with-czech-name
2. error occurs
3. nothing in the audit.log
  
I am going to provide a patch to solve this problem.

Comment 1 Lukas Zapletal 2011-01-24 10:01:45 UTC
The problem is in the src/pulp/server/auditing.py method audit_repr(value). It tries to decode both strings and unicode objects. Unicode objects in Python are not subjects of decoding.

I think the intention for this method was to "Return an audit-friendly representation of a value." and to encode unicode strings to simple ASCII representation. For example to log string

Příliš žluťoučký kůŇ úpěl Ďábelské ódy

as

P??li? ?lu?ou?k? k?? ?p?l ??belsk? ?dy

in the events.log.

For this case I have prepared a patch that fixes the audit_repr method. It decodes only string objects and encodes them to ASCII properly. Unicode objects are only encoded to ASCII since they are already "decoded". Attaching.

The question is if this is correct approach because for Chineese or Japanese the unicode messages could be quite useless (like "???" or "??????????"). Therefore maybe the pulp authors would like to prefer to output strings "as is". In this case modification needs to be done since currently the Pulp server is trying to decode already decoded strings. I can provide the patch for this outputting as well.

Comment 2 Lukas Zapletal 2011-01-24 10:02:28 UTC
Created attachment 474938 [details]
Solution A patch

Comment 3 Lukas Zapletal 2011-03-03 16:37:28 UTC
Preethi - forgot to set MODIFIED flag. This has been commited and pushed weeks ago. Should work now.

Comment 4 Jeff Ortel 2011-03-07 20:43:24 UTC
Build: 0.145

Comment 5 Preethi Thomas 2011-03-09 15:03:37 UTC
verified
[root@preethi ~]# rpm -q pulp
pulp-0.0.146-1.fc14.noarch

[root@preethi ~]# pulp-admin repo create --arch=x86_64 --feed yum:http://download.fedora.redhat.com/pub/fedora/linux/updates/13/x86_64/ --name="Příliš žluťoučký kůŇ úpěl Ďábelské ódy" --id=fedora-repo-with-czech-name
Successfully created repository [ fedora-repo-with-czech-name ]

[root@preethi ~]# pulp-admin -u admin -p admin repo list+------------------------------------------+
       List of Available Repositories
+------------------------------------------+

Id                      fedora-repo-with-czech-name
Name                    Příliš žluťoučký kůŇ úpěl Ďábelské ódy
FeedURL                 http://download.fedora.redhat.com/pub/fedora/linux/updates/13/x86_64/
FeedType                yum                      
Arch                    x86_64                   
Sync Schedule           None                     
Packages                0                        
Files                   0                        
Distributions           None                     
Publish                 True                     
Clones                  []                       
Groups                  None                     
Filters                 []

Comment 6 Preethi Thomas 2011-08-15 15:14:54 UTC
Closing with current community release

pulp-0.0.223