Bug 867647 - POST to sync repository API with UTF8 username causes traceback
POST to sync repository API with UTF8 username causes traceback
Status: CLOSED WONTFIX
Product: Pulp
Classification: Community
Component: API/integration (Show other bugs)
1.1.0
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Jason Connor
Preethi Thomas
:
Depends On:
Blocks: 835586
  Show dependency treegraph
 
Reported: 2012-10-17 19:09 EDT by Mike McCune
Modified: 2014-03-30 21:40 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-10-24 11:55:32 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
call the script with a username each time (534 bytes, application/octet-stream)
2012-10-17 19:10 EDT, Mike McCune
no flags Details
replacement that sets the content-type header (535 bytes, application/octet-stream)
2012-10-17 19:11 EDT, Mike McCune
no flags Details

  None (edit)
Description Mike McCune 2012-10-17 19:09:04 EDT
If you have a user in pulp with UTF8 characters in the username you can't POST calls to:

 https://localhost/pulp/api/repositories/$REPO/sync/

without getting the dreaded:

 File "/usr/lib/python2.6/site-packages/pulp/server/db/model/persistence.py", line 55, in _process_value
    value = value.decode('utf-8')
  File "/usr/lib64/python2.6/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 271: invalid continuation byte


error ...

See attached bash script that reproduces the error with the following steps.  call the script with a new username each time, you can try with ascii which works fine or latin1 or utf8 chars.  Apache doesn't seem to like headers with latin chars ..

ASCII works fine:


$ ./utf8-pain.bash ascii1
Successfully created repository [ kpJfjWgFow ]

Successfully created user [ ascii1 ] with name [ None ]

[ ascii1 ] added to role [ super-users ]

{"scheduled_time": "2012-10-17T23:05:59Z", "exception": null, "traceback": null, "job_id": null, "class_name": null, "start_time": null, "args": ["kpJfjWgFow"], "method_name": "_sync", "finish_time": null, "state": "waiting", "result": null, "scheduler": "immediate", "progress": null, "id": "3713ddd7-18af-11e2-b28c-1803734d16c4"}

$ tail -f /var/log/pulp/pulp.log in another window and look for the above exception


non-ASCII will cause the exception:

$ ./utf8-pain.bash 7Mané
....
$ tail  /var/log/pulp/pulp.log
...
 File "/usr/lib64/python2.6/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 271: invalid continuation byte
Comment 1 Mike McCune 2012-10-17 19:10:11 EDT
Created attachment 629115 [details]
call the script with a username each time

$ ./utf8-pain.bash some-new-user

$ ./utf8-pain.bash some-non-ascii-7Mané
Comment 2 Mike McCune 2012-10-17 19:11:31 EDT
Created attachment 629116 [details]
replacement that sets the content-type header
Comment 3 Mike McCune 2012-10-22 15:25:52 EDT
https://github.com/pulp/pulp/pull/111
Comment 4 Jason Connor 2012-10-24 11:55:32 EDT
Pulp will only support ASCII usernames

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