Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 381583 - app-portage/gentoolkit-0.3.0.4: equery check - UnicodeDecodeError
Summary: app-portage/gentoolkit-0.3.0.4: equery check - UnicodeDecodeError
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-02 16:06 UTC by Paul Varner (RETIRED)
Modified: 2013-10-03 08:09 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Varner (RETIRED) gentoo-dev 2011-09-02 16:06:15 UTC
# equery check app-misc/ca-certificates
Traceback (most recent call last):
  File "/usr/bin/equery", line 38, in <module>
    equery.main()
  File "/usr/lib64/python3.2/site-packages/gentoolkit/equery/__init__.py", line 352, in main
    loaded_module.main(module_args)
  File "/usr/lib64/python3.2/site-packages/gentoolkit/equery/check.py", line 286, in main
    check(matches)
  File "/usr/lib64/python3.2/site-packages/gentoolkit/equery/check.py", line 80, in __call__
    check_results = self._run_checks(pkg.parsed_contents())
  File "/usr/lib64/python3.2/site-packages/gentoolkit/equery/check.py", line 108, in _run_checks
    if not os.path.exists(cfile):
  File "/usr/lib64/python3.2/genericpath.py", line 18, in exists
    os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character '\xdc' in position 36: ordinal not in range(128)
Comment 1 Zac Medico gentoo-dev 2011-09-02 20:08:01 UTC
In portage, we use the portage._unicode_module_wrapper class to manually convert unicode arguments to bytes before they are passed to the os module. Passing raw bytes to the os module allows us to use it with file names that aren't necessarily encoded with the same encoding as sys.getfilesystemencoding().
Comment 2 Francesco Turco 2013-09-15 10:51:27 UTC
I get a very similar error message:

# equery check ca-certificates
Traceback (most recent call last):
  File "/usr/bin/equery-python3.2", line 38, in <module>
    equery.main(sys.argv)
  File "/usr/lib64/python3.2/site-packages/gentoolkit/equery/__init__.py", line 357, in main
    loaded_module.main(module_args)
  File "/usr/lib64/python3.2/site-packages/gentoolkit/equery/check.py", line 288, in main
    check(matches)
  File "/usr/lib64/python3.2/site-packages/gentoolkit/equery/check.py", line 80, in __call__
    check_results = self._run_checks(pkg.parsed_contents())
  File "/usr/lib64/python3.2/site-packages/gentoolkit/equery/check.py", line 109, in _run_checks
    if not os.path.exists(real_cfile):
  File "/usr/lib64/python3.2/genericpath.py", line 18, in exists
    os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character '\u011f' in position 49: ordinal not in range(128)

-----

I'm running app-portage/gentoolkit-0.3.0.8-r1.
Comment 3 Brian Dolbec gentoo-dev 2013-09-15 15:07:52 UTC
I can't replicate the problem on my system.  (python-2.7 is default)

big_daddy gentoolkit # equery check ca-certificates
* Checking app-misc/ca-certificates-20130610 ...
   497 out of 497 files passed

big_daddy gentoolkit # equery-python3.2 check ca-certificates
* Checking app-misc/ca-certificates-20130610 ...
   497 out of 497 files passed

big_daddy gentoolkit # 


Francesco, can you see if running "equery-python2.7 check ca-certificates" (provided gentoolkit is installed in 2.7 as well) also produces the same error?

Also what is your locale setting? and installed portage version?
Comment 4 Francesco Turco 2013-09-15 16:21:21 UTC
"equery-python2.7 check ca-certificates" produces the same error message.

portage version is 2.2.4.

"locale" command returns POSIX... but

# localectl | grep "System Locale"
   System Locale: LANG=en_US.utf8

I'm running systemd, perhaps is due to bug 465468. If I set the LANG variable correctly in /etc/env.d/02locale and I run env-update && source /etc/profile then equery works.

I'm still not sure if this problem is due to a misconfiguration on my side or due to a bug in equery.
Comment 5 Paul Varner (RETIRED) gentoo-dev 2013-10-03 08:09:11 UTC
It's a bug in equery that is only shows up when using a non UTF-8 locale.  The workaround is to make sure that your locale settings are using UTF-8 when running equery.