Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'stg show' chokes on unicode with python 2.6 #19

Closed
awilliam opened this issue Jan 31, 2018 · 2 comments
Closed

'stg show' chokes on unicode with python 2.6 #19

awilliam opened this issue Jan 31, 2018 · 2 comments
Assignees

Comments

@awilliam
Copy link

$ python --version
Python 2.6.6
$ stg --version
Stacked GIT 0.18-101-g8fa6
git version 2.16.1
Python version 2.6.6 (r266:84292, Aug 9 2016, 06:11:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]
$ stg show
Error: Unhandled exception:
Traceback (most recent call last):
File "/home/alwillia/lib/python2.6/site-packages/stgit/main.py", line 194, in _main
ret = command.func(parser, options, args)
File "/home/alwillia/lib/python2.6/site-packages/stgit/commands/show.py", line 83, in func
pager(commit_str)
File "/usr/lib64/python2.6/pydoc.py", line 1312, in pager
pager(text)
File "/usr/lib64/python2.6/pydoc.py", line 1326, in
return lambda text: pipepager(text, os.environ['PAGER'])
File "/usr/lib64/python2.6/pydoc.py", line 1353, in pipepager
pipe.write(text)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 75: ordinal not in range(128)

$ git show | head
commit c7d12e277b834d4a05a7d3529e143780c8cfedb2
Author: Christian König ckoenig.leichtzumerken@gmail.com
Date: Tue Jan 16 10:43:17 2018 +0100

x86/PCI: apply the AMD window fixup on resume as well

We need to reprogram the register content during resume.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reported-by: Tom St Denis <tom.stdenis@amd.com>

This is a patch that recently generated an upstream lkml thread with Bjorn Helgaas and Linus Torvalds over the handling of unicode in stg imported commits. The unicode appears to be handled correctly on import now and I can 'stg edit' the commit, but 'stg show' chokes on it.

@jpgrayson jpgrayson self-assigned this Feb 6, 2018
jpgrayson added a commit that referenced this issue Feb 6, 2018
The pager used with `stg show`, `stg patches`, and `stg diff` comes from
the pydoc module in the Python standard library.

For Python 2.6, the pager attempts to encode the unicode text as ascii and
thus any non-ascii text causes the pager to crash.

To repair, we adopt the strategy used in Python 2.7: encode the text to be
paged using the locale's preferred encoding and 'xmlcharrefreplace' error
handling.

Repairs #19.

Signed-off-by: Peter Grayson <jpgrayson@gmail.com>
@jpgrayson
Copy link
Collaborator

I have pushed a repair for this issue. @awilliam, if you could try it out and let me know if there are still any issues in your environment, that would be appreciated.

@awilliam
Copy link
Author

awilliam commented Feb 6, 2018

Confirmed, works! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants