Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 282192 - Emerge broken. Stops with UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in portage/util.py
Summary: Emerge broken. Stops with UnicodeDecodeError: 'ascii' codec can't decode byte...
Status: RESOLVED DUPLICATE of bug 281199
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL: http://www.gentooforum.de/post/123212...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-21 11:51 UTC by Oliver Maurhart
Modified: 2010-07-15 08:23 UTC (History)
2 users (show)

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


Attachments
Patch to /usr/bin/emerge to FORCE latin-1 encoding (emerge.patch,332 bytes, text/plain)
2009-08-21 11:56 UTC, Oliver Maurhart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Maurhart 2009-08-21 11:51:33 UTC
After the introduction of python-3.1 and python-wrapper, python-encoding git crazy on some machines. On Systems with possibly mixed encodings (e.g. latin-1) emerge breaks with an UnicodeDecodeError.

This happens for instance when emerge =sys-apps/kbd-1.13-r1, which leads then to something like this:

>>> Installing (1 of 1) sys-apps/kbd-1.13-r1

 * Messages for package sys-apps/kbd-1.13-r1:

 * Applying kbd-1.13-dont-use-error.patch ...
 * Applying kbd-1.12-configure-LANG.patch ...
 * Applying kbd-1.12-unimap.patch ...
 * Applying kbd-1.12-cz-qwerty-map.patch ...
 * Applying kbd-1.12-jp-escape.patch ...
 * Applying kbd-1.12-xcompile.patch ...

 * Messages for package sys-apps/kbd-1.13-r1:

 * Applying kbd-1.13-dont-use-error.patch ...
 * Applying kbd-1.12-configure-LANG.patch ...
 * Applying kbd-1.12-unimap.patch ...
 * Applying kbd-1.12-cz-qwerty-map.patch ...
 * Applying kbd-1.12-jp-escape.patch ...
 * Applying kbd-1.12-xcompile.patch ...
Traceback (most recent call last):
  File "/usr/bin/emerge", line 40, in <module>
    retval = emerge_main()
  File "/usr/lib/portage/pym/_emerge/main.py", line 1397, in emerge_main
    myopts, myaction, myfiles, spinner)
  File "/usr/lib/portage/pym/_emerge/actions.py", line 463, in action_build
    retval = mergetask.merge()
  File "/usr/lib/portage/pym/_emerge/Scheduler.py", line 821, in merge
    rval = self._merge()
  File "/usr/lib/portage/pym/_emerge/Scheduler.py", line 1125, in _merge
    self._main_loop()
  File "/usr/lib/portage/pym/_emerge/Scheduler.py", line 1262, in _main_loop
    self._poll_loop()
  File "/usr/lib/portage/pym/_emerge/PollScheduler.py", line 127, in _poll_loop
    handler(f, event)
  File "/usr/lib/portage/pym/_emerge/SpawnProcess.py", line 197, in _output_handler
    self._unregister_if_appropriate(event)
  File "/usr/lib/portage/pym/_emerge/AbstractPollTask.py", line 27, in _unregister_if_appropriate
    self.wait()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib/portage/pym/_emerge/EbuildPhase.py", line 76, in _post_phase_exit
    self.wait()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib/portage/pym/_emerge/TaskSequence.py", line 43, in _task_exit_handler
    self.wait()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib/portage/pym/_emerge/CompositeTask.py", line 105, in _default_final_exit
    return self.wait()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib/portage/pym/_emerge/EbuildBuild.py", line 182, in _build_exit
    self.wait()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib/portage/pym/_emerge/CompositeTask.py", line 105, in _default_final_exit
    return self.wait()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib/portage/pym/_emerge/Scheduler.py", line 1104, in _build_exit
    self._schedule()
  File "/usr/lib/portage/pym/_emerge/PollScheduler.py", line 43, in _schedule
    return self._schedule_tasks()
  File "/usr/lib/portage/pym/_emerge/Scheduler.py", line 1284, in _schedule_tasks
    if q.schedule():
  File "/usr/lib/portage/pym/_emerge/SequentialTaskQueue.py", line 55, in schedule
    task.start()
  File "/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 24, in start
    self._start()
  File "/usr/lib/portage/pym/_emerge/PackageMerge.py", line 44, in _start
    self.returncode = self.merge.merge()
  File "/usr/lib/portage/pym/_emerge/MergeListItem.py", line 148, in merge
    retval = self._install_task.install()
  File "/usr/lib/portage/pym/_emerge/EbuildBuild.py", line 272, in install
    rval = merge.execute()
  File "/usr/lib/portage/pym/_emerge/EbuildMerge.py", line 32, in execute
    blockers=self.find_blockers)
  File "/usr/lib/portage/pym/portage/__init__.py", line 6865, in merge
    mydbapi=mydbapi, prev_mtimes=prev_mtimes)
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 4037, in merge
    mydbapi=mydbapi, prev_mtimes=prev_mtimes)
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 4047, in _merge
    cleanup=cleanup, mydbapi=mydbapi, prev_mtimes=prev_mtimes)
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 3509, in treewalk
    if self.mergeme(srcroot, destroot, outfile, secondhand, "", cfgfiledict, mymtime):
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 3892, in mergeme
    join(offset, x), cfgfiledict, thismtime):
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 3892, in mergeme
    join(offset, x), cfgfiledict, thismtime):
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 3892, in mergeme
    join(offset, x), cfgfiledict, thismtime):
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 3892, in mergeme
    join(offset, x), cfgfiledict, thismtime):
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 3892, in mergeme
    join(offset, x), cfgfiledict, thismtime):
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 3892, in mergeme
    join(offset, x), cfgfiledict, thismtime):
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 3902, in mergeme
    protected = self.isprotected(mydest)
  File "/usr/lib/portage/pym/portage/util.py", line 1250, in isprotected
    if len(ppath) > masked and obj.startswith(ppath):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 36: ordinal not in range(128)


My emerge --info

# emerge --info                
Portage 2.2_rc38 (default/linux/x86/2008.0/desktop, gcc-4.3.4, glibc-2.10.1-r0, 2.6.31-rc6 i686)
=================================================================                               
System uname: Linux-2.6.31-rc6-i686-Intel-R-_Pentium-R-_M_processor_2.13GHz-with-gentoo-2.0.1   
Timestamp of tree: Fri, 21 Aug 2009 05:00:01 +0000                                              
ccache version 2.4 [enabled]                                                                    
app-shells/bash:     4.0_p28                                                                    
dev-java/java-config: 2.1.8-r1                                                                  
dev-lang/python:     2.6.2-r1, 3.1.1                                                            
dev-python/pycrypto: 2.0.1-r8                                                                   
dev-util/ccache:     2.4-r8                                                                     
dev-util/cmake:      2.6.4-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.4.3-r3
sys-apps/sandbox:    2.0
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.4_p6, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer -U_FORTIFY_SOURCE"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /var/lib/hsqldb"
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=native -O2 -pipe -fomit-frame-pointer -U_FORTIFY_SOURCE"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests ccache distlocks fixpackages parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.mneisen.org/ http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://gentoo.mirror.pw.edu.pl/ http://gentoo.prz.rzeszow.pl http://gentoo.tiscali.nl/ http://ftp.gentoo.bg/ http://de-mirror.org/distro/gentoo/ http://gentoo.virginmedia.com/ http://distfiles.gentoo.bg/ http://mirror.uni-c.dk/pub/gentoo/ http://files.gentoo.gr http://mirror.gentoo.no/ http://mirrors.ludost.net/gentoo/ http://ftp.dei.uc.pt/pub/linux/gentoo/ http://mirror.mdfnet.se/mirror/gentoo http://ftp.rhnet.is/pub/gentoo/ http://mirror.hamakor.org.il/pub/mirrors/gentoo/ http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://gd.tuwien.ac.at/opsys/linux/gentoo/ http://gentoo.osuosl.org/"
LANG="en_US"
LC_ALL="en_US"
LDFLAGS="-Wl,-O1"
LINGUAS="en de"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
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/local/portage/layman/desktop-effects /usr/local/portage/layman/ephemeral /usr/local/portage/layman/kde-testing /usr/local/portage/layman/sunrise /usr/local/portage/local-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow X a52 aac aalib acl acpi aften alsa amarok amr amrnb apache2 apm automount avahi bash-completion berkdb bluetooth branding bzip2 cairo calendar caps cdaudio cdda cddb cdr cgi cli consolekit cpudetection cracklib crypt cscope cups curl daap dbus dga directfb divx dns dri dts dv dvb dvd dvdr dvdread dvn eds emboss encode esd evo exif expat fam fbcon ffmpeg firefox flac fortran ftp gd gdbm gif glitz gmp gnome gnutls gpm graphviz gstreamer gtk hal htmlhandbook iconv ifp imagemagick imap imlib inifiles ipod ipv6 irmc isdnlog jack java jpeg jpeg2k kde kde4 kipi lame laptop lcms lcmsi ldap libnotify lm_sensros lzo mad mikmod mmext mmx mng mono mp3 mp4 mpeg mtp mudflap mysql mysqli mythtv nas ncurses nepomuk nforce2 nls nptl nptlonly nsplugin offensive ogg openal openct openexr opengl openmp pam pch pcmcia pcre pdf perl php plasma plib png ppds pppd python qt3 qt3support qt4 quicktime rar readline realmedia recode reflection rtc samba sasl sdl semantic-desktop server session sharedext sharedmem soap spell spl sqlite sqlite3 sse sse2 ssl startup-notification subversion svg sysfs tcpd theora tidy tiff tivo tokenizer truetype unicode usb v4l v4l2 vcd vidx vim vim-syntax vorbis webdav webkit win32codecs winetools wmp wxwindows x264 x86 xanim xattr xcb xcomposite xforms xine xinerama xml xorg xprint xscreensaver xsl xulrunner xv xvid zeroconf zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 auth_digest authn_anon authn_dbd 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 dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de" USERLAND="GNU" VIDEO_CARDS="radeon vesa ati"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS







Reproducible: Always

Steps to Reproduce:
1. have portage_2.2_rc38
2. have python2.6, python3.1 and python-wrapper
3. emerge =sys-apps/kbd-1.13-r1 

Actual Results:  
Emerge breaks with an Unicode error.

Expected Results:  
It should compile and install the software.
Comment 1 Oliver Maurhart 2009-08-21 11:54:31 UTC
I managed to get around this bug by applying a patch to /usr/bin/emerge (!!!)

--- /usr/bin/emerge.org 2009-08-21 13:43:46.000000000 +0200
+++ /usr/bin/emerge     2009-08-21 13:40:25.000000000 +0200
@@ -4,6 +4,9 @@
 # $Id: emerge 13895 2009-08-04 16:05:50Z zmedico $

 import sys
+reload(sys)
+sys.setdefaultencoding('latin-1')
+
 # This block ensures that ^C interrupts are handled quietly.
 try:
        import signal


This one hammers the encoding rules to "latin-1" which works then.

BUT: This is an awfull, nasty, ugly hack! sys.setdefaultencoding is harmful, isn't it?

Comment 2 Oliver Maurhart 2009-08-21 11:56:26 UTC
Created attachment 201858 [details]
Patch to /usr/bin/emerge to FORCE latin-1 encoding

Added path described in previous post.
Comment 3 Mounir Lamouri (volkmar) (RETIRED) gentoo-dev 2009-08-21 13:02:18 UTC

*** This bug has been marked as a duplicate of bug 281199 ***