Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 286290 - app-portage/layman-1.2.3: error when invoking layman with "-Lv"
Summary: app-portage/layman-1.2.3: error when invoking layman with "-Lv"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Sebastian Pipping
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-24 19:49 UTC by makism
Modified: 2010-01-02 03:41 UTC (History)
1 user (show)

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


Attachments
Patch for http://www.gentoo.org/proj/en/overlays/layman-global.txt (layman-global.txt.patch,1.22 KB, patch)
2009-10-09 19:04 UTC, Conway S. Smith
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description makism 2009-09-24 19:49:53 UTC
When invoking layman with "-Lv" it crashes, or better an exception/error is thrown.
I tried to do a "-f" first, but nothing changed.

Reproducible: Always

Steps to Reproduce:
1. `layman -Lv`
2.
3.

Actual Results:  
Traceback (most recent call last):
  File "/usr/bin/layman", line 37, in <module>
    main()
  File "/usr/bin/layman", line 34, in main
    Actions(Config())
  File "/usr/lib/python2.6/site-packages/layman/action.py", line 498, in __init__
    result += i[1](config).run()
  File "/usr/lib/python2.6/site-packages/layman/action.py", line 380, in run
    for i in self.rdb.list(self.config['verbose'], self.config['width']):
  File "/usr/lib/python2.6/site-packages/layman/overlay.py", line 221, in list
    result.append((str(overlay), overlay.is_supported(),
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 307: ordinal not in range(128)

Expected Results:  
A complete listing with all available overlays and a description for each overlay.

Portage 2.2_rc41 (default/linux/x86/2008.0/desktop, gcc-4.3.2, glibc-2.9_p20081201-r2, 2.6.31-zen1 i686)
=================================================================
System uname: Linux-2.6.31-zen1-i686-AMD_Athlon-tm-_XP_1800+-with-gentoo-2.0.0
Timestamp of tree: Thu, 24 Sep 2009 17:45:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p28
dev-java/java-config: 1.3.7-r1, 2.1.8-r1
dev-lang/python:     2.6.2-r1
dev-python/pycrypto: 2.0.1-r8
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.6.4
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.4.3-r2
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i486-pc-linux-gnu"
CFLAGS="-march=athlon-xp -mtune=athlon-xp -O2 -pipe"
CHOST="i486-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=athlon-xp -mtune=athlon-xp -O2 -pipe"
DISTDIR="/media/Files/Portage-Distfiles/"
FEATURES="assume-digests ccache collision-protect distlocks elog fixpackages metadata-transfer parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://ftp.cc.uoc.gr/mirrors/linux/gentoo/ ftp://ftp.cc.uoc.gr/mirrors/linux/gentoo/ "
LC_ALL="el_GR.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="el en"
MAKEOPTS="-j2"
PKGDIR="/media/Files/Portage-Packages/"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--bwlimit=80"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/sunrise /usr/portage/local/layman/java-overlay /usr/portage/local/layman/ikelos /usr/portage/local/layman/php-testing /usr/portage/local/layman/php-experimental /usr/portage/local/layman/python /usr/portage/local/layman/kde-testing /usr/portage/local/layman/rostov /usr/portage/local/layman/zen-overlay /usr/portage/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acl acpi alsa bash-completion berkdb branding bzip2 cairo cdr cli cracklib crypt dbus dri dts dvd dvdr eds emboss encode esd evo flac fortran gdbm gif gpm gstreamer hal iconv ipv6 isdnlog jpeg kde libnotify mad mikmod mmx modules mp3 mp4 mpeg mudflap ncurses nls nptl nptlonly ogg opengl openmp pam pcre pdf perl png ppds pppd python qt3support qt4 quicktime readline reflection sdl session spell spl sse ssl startup-notification svg sysfs tcpd thunar tiff truetype unicode usb vim-syntax vorbis win32codecs x264 x86 xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ca0106" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="el en" USERLAND="GNU" VIDEO_CARDS="radeon vesa virtualbox"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Comment 1 Conway S. Smith 2009-10-09 18:57:57 UTC
I also encountered this.  I think the best fix for now is to fix layman's remote/global list of overlays w/ the attached patch.  Long rambling description below.

I found that it was being caused by the description for the multimedia overlay using Unicode U+2019 "RIGHT SINGLE QUOTATION MARK" for the apostrophe in "gentoo’s", which apparently str() in python-2.6 can't handle.  Editing /usr/lib64/python2.6/site-packages/layman/overlay.py & changing str(overlay) to unicode(overlay) gets it past the traceback makism posted, and it looks like it mostly works, except for a few funky issues I don't understand.

Just running "layman -vL" works fine, printing out all the info for all the overlays, including those after multimedia, but the Unicode U+2019 "RIGHT SINGLE QUOTATION MARK" somehow becomes Unicode U+00e2 "LATIN SMALL LETTER A WITH CIRCUMFLEX" - "gentoo’s" becomes "gentooâs".  Which is weird, but I could live with that.  But what's even weirder is that if stdout is redirected, as with "layman -vL | cat", it prints everything through the first line of multimedia's description, but when it hits the line w/ the Unicode character it dies like this:

* multimedia
* ~~~~~~~~~~
* Source  : git://gitorious.org/gentoo-multimedia/gentoo-multimedia.git
* Contact : media-video@gentoo.org
* Type    : Git; Priority: 50
* 
* Description:
*   Repository for development of (mostly bleeding-edge)
*               multimedia packages for Gentoo Linux. This is the official overlay
Traceback (most recent call last):
  File "/usr/bin/layman", line 37, in <module>
    main()
  File "/usr/bin/layman", line 34, in main
    Actions(Config())
  File "/usr/lib64/python2.6/site-packages/layman/action.py", line 498, in __init__ 
    result += i[1](config).run()
  File "/usr/lib64/python2.6/site-packages/layman/action.py", line 385, in run
    OUT.info(i[0], 1)
  File "/usr/lib64/python2.6/site-packages/layman/debug.py", line 308, in info
    print self.maybe_color('green', '* ') + i
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 35: ordinal not in range(128)

I resolved that by editing /usr/lib64/python2.6/site-packages/layman/debug.py from
    print self.maybe_color('green', '* ') + i
to
    print self.maybe_color('green', '* ') + i.encode('utf_8')

After which it works when redirecting stdout (but again with "gentoo’s" becoming "gentooâs").

But I don't think hacking layman to play well with unicode is the way to go right now, what with the python3 unicode->str stuff.  My attached patch for layman-global.txt makes it work w/ layman-1.2.3.  It replaces the unicode apostrophe w/ ascii, and changes multimedia's description's white-space/line-wrapping to be more in-line w/ the rest of the file.

Until it's applied on http://www.gentoo.org/proj/en/overlays/layman-global.txt, users can apply it to their local cache (for me it was /usr/local/portage/layman/cache_65bd38402ac8431067b54904bd2ed2d1.xml), and run "layman -nLv".
Comment 2 Conway S. Smith 2009-10-09 19:04:14 UTC
Created attachment 206572 [details, diff]
Patch for http://www.gentoo.org/proj/en/overlays/layman-global.txt
Comment 3 Sebastian Pipping gentoo-dev 2010-01-02 03:41:52 UTC
This should be fixed now.  app-portage/layman-1.2.4-r2 comes with a backport of the fix: please try it out and re-open this bug if necessary.  Thanks for reporting!

http://layman.git.sourceforge.net/git/gitweb.cgi?p=layman/layman;a=commitdiff;h=a4ce3e5d2076528950155069999873a92b87833e