Bug 672171 - Pulp server cannot process a repo with name encoded in unicode
Summary: Pulp server cannot process a repo with name encoded in unicode
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Lukas Zapletal
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks: verified-to-close
TreeView+ depends on / blocked
 
Reported: 2011-01-24 09:49 UTC by Lukas Zapletal
Modified: 2011-08-15 15:14 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-08-15 15:14:54 UTC
Embargoed:


Attachments (Terms of Use)
Solution A patch (1.17 KB, patch)
2011-01-24 10:02 UTC, Lukas Zapletal
no flags Details | Diff

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


Note You need to log in before you can comment on or make changes to this bug.