Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 304781 - app-portage/layman-1.2.3 Better handling of bad cache file
Summary: app-portage/layman-1.2.3 Better handling of bad cache file
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Sebastian Pipping
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-12 22:01 UTC by Daniel Santos
Modified: 2010-02-18 05:32 UTC (History)
0 users

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 Daniel Santos 2010-02-12 22:01:13 UTC
I recently setup a system and forgot to link my /usr/src/debug and /usr/lib/debug to another device, as I had planned and my /usr device reached capacity, (being that I'm using the "splitdebug" and "installsources" FEATURES).  While this condition existed (and probably another app was attempting to write to it), I happen to run a "layman -S".  The result was that the file /usr/local/portage/layman/cache_65bd38402ac8431067b54904bd2ed2d1.xml was truncated and I ended up with this error:

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 479, in __init__
    Fetch(config).run()
  File "/usr/lib64/python2.6/site-packages/layman/action.py", line 66, in __init__
    self.db = RemoteDB(config)
  File "/usr/lib64/python2.6/site-packages/layman/db.py", line 237, in __init__
    Overlays.__init__(self, paths, ignore, quiet)
  File "/usr/lib64/python2.6/site-packages/layman/overlay.py", line 76, in __init__
    self.read_file(path)
  File "/usr/lib64/python2.6/site-packages/layman/overlay.py", line 90, in read_file
    self.read(document)
  File "/usr/lib64/python2.6/site-packages/layman/overlay.py", line 111, in read
    + str(error))
Exception: Failed to parse the overlay list!
Error was:
no element found: line 1, column 0

Attempting to run layman with -L and a variety of other options resulted in the same error.  Unmerging and remerging did not solve the problem either.  The solution was to remove the bad cache file.

Ideally, while a file that isn't intended to be user-edited (as opposed to /usr/local/portage/layman/make.conf, for example) gets screwed up like this, there should be a way that the app can clean it up.

I don't know the inner workings of layman well enough to suggestion definite solutions (I don't even know python), but perhaps the solution can be as simple as recording a recursion count in for the function that parses the cache and if it fails, attempt to rebuild the cache and read it again, as long as you aren't failing twice (so you don't have that whole infinite recursion / stack overflow thing).

Alternately, just removing potentially crufty files like the .cache file upon unmerge would do the trick with minimal hassle as well (i.e., the unmerge, re-merge would fix it).

Portage 2.1.7.16 (default/linux/amd64/10.0/desktop, gcc-4.3.4, glibc-2.10.1-r1, 2.6.31-gentoo-r6 x86_64)
=================================================================
System uname: Linux-2.6.31-gentoo-r6-x86_64-AMD_Phenom-tm-_9850_Quad-Core_Processor-with-gentoo-1.12.13
Timestamp of tree: Fri, 12 Feb 2010 18:00:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p35
dev-java/java-config: 2.1.10
dev-lang/python:     2.6.4
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1 sun-bcla-java-vm skype-eula"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=amdfam10 -O2 -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /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/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=amdfam10 -O2 -ggdb"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests buildpkg ccache distlocks fixpackages installsources news parallel-fetch protect-owned sandbox sfperms splitdebug strict unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://mirrors.cs.wmich.edu/gentoo http://mirror.mcs.anl.gov/pub/gentoo/ http://osmirrors.cerias.purdue.edu/pub/gentoo/"
LDFLAGS="-Wl,-O1"
LINGUAS="en_US en"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="bzip2"
PORTAGE_COMPRESS_FLAGS="-9"
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 --exclude '/lost+found'"
PORTAGE_TMPDIR="/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/sunrise /usr/local/portage/layman/kde-sunset /usr/local/portage/layman/zugaina /usr/local/portage/layman/java-overlay /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext 3ds 64bit 7zip X Xaw3d a52 aac aalib acl acpi aim aio akode alsa amd64 amr ao aotuv apache2 applet ares arts async audacious audiofile authdaemond authfile autoipd automount bash-completion berkdb binfilter bittorrent bl bluetooth bonjour boost branding bsf bzip2 c3p0 cairo calendar cdaudio cdb cdda cddb cdparanoia cdr cegui cg cgi chm cjk cli commons-digester console consolekit cpufreq cpulimit cracklib crypt cscope css cups curl curlwrappers custom-optimization cvs cxx dbus dedicated devil dga dirac directfb divx djbfft djvu dmx dns dolby-record-switch dri dtmf dts dv dvb dvd dvdr editor eds emboss emoticon encode enscript evo excel exif expat extraicons faac faad fam fasttrack fax fbcon ffmpeg fftw firefox fits flac flash fltk fluidsynth fmod font-server fontconfig fontforge foomaticdb fortran fping fpx ftp fuse fusion gadu gcj gd gdbm geos ggi gif ginac git glib glitz glut gmedia gmp gmtfull gnokii gnome gnutella gnutls gphoto2 gpm gps graphviz gs gsl gsm gstreamer gtk gzip h323 hal hddtemp html htmlhandbook hwmixer icecast iceweasel iconv icq icu id3 id3tag idn ieee1394 ilbc imagemagick imap imlib inifile irc irda irrlicht jabber jack jadetex java java5 java6 javascript jbig jce jingle jmx joystick jpeg jpeg2k kde kdrive kpathsea ladspa lame lash latex lcms ldap libcaca libnotify libsamplerate libvisual libwww lirc live lm_sensors log4j logitech-mouse lua lzma lzo mad maildir maps math md5sum meanwhile midi mikmod mime mjpeg mmap mmkeys mmx mmxext mng modperl modplug modules motif mouse mozdevelop mozilla mp2 mp3 mp4 mp4live mpeg mpeg2 mplayer msn mtp mudflap multicall multilib multislot multitarget musepack music musicbrainz mysql mysqli mythtv nas ncurses net netjack network njb nls nntp nptl nptlonly nsplugin nss nvidia nvtv ode odk offensive ogg openal openexr opengl openmp oscar otr pam pango pch pcntl pcre pda pdf perl php player plotutils png portaudio posix postproc ppds pppd pulseaudio python qq qt3support qt4 quicktime radio rar raw readline reflection rrdcgi rss rtc ruby samba sametime sasl scanner schroedinger sdl sdl-image sdl-sound sensord session sharedext silc sip slp smp smtp sndfile snmp soap sockets sound speex spell spl sql sqlite sqlite3 sse sse2 sse3 ssl startup-notification stream subtitles subversion suexec svg sysfs syslog sysvipc t1lib tagwriting tcl tcpd test tga theora threads thumbnail thunar tidy tiff timidity tk tokenizer tools transcode translator trayicon truetype tse3 twolame udev unicode upnp urandom usb userlocales v4l v4l2 vcd vdpau vdr vhosts videos vim-syntax vim-with-x visualization vorbis vorbis-psy vxml wav wavpack webdav wifi wma wmf wxwidgets wxwindows x264 xanim xattr xcb xcomposite xface xforms xft xine xinerama xinetd xml xmlreader xmlrpc xmlwriter xorg xpm xprint xscreensaver xsl xulrunner xv xvid xvmc yaepg yahoo yv12 zeroconf zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci 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_alias authn_dbd 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 dbd deflate dir disk_cache dumpio env expires ext_filter file_cache filter headers ident imagemap include info log_config log_forensic logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias substitute" ELIBC="glibc" FOO2ZJS_DEVICES="hpp1006" INPUT_DEVICES="keyboard mouse joystick evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_US en" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Sebastian Pipping gentoo-dev 2010-02-18 05:32:11 UTC
I have improved handling of a corrupted cache now.
Please check it out (e.g. by emerging =app-portage/layman-9999) and re-open this bug if necessary. Thanks for reporting!

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