Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 211716 - app-portage/gentoolkit-0.2.3-r1: equery fails running under unprivileged account in the case of separate /var/db/pkg/ partition
Summary: app-portage/gentoolkit-0.2.3-r1: equery fails running under unprivileged acco...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 170220
  Show dependency tree
 
Reported: 2008-02-28 12:12 UTC by Martin Kampas
Modified: 2008-04-24 02: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 Martin Kampas 2008-02-28 12:12:19 UTC
Problem is in existence of the lost+found directory.

Equery fails with portage_exception.PermissionDenied: /var/db/pkg/lost+found

$ equery list portage
Traceback (most recent call last):
  File "/usr/bin/equery", line 27, in <module>
    import gentoolkit
  File "/usr/lib/gentoolkit/pym/gentoolkit/__init__.py", line 33, in <module>
    virtuals = portage.db[portage.root]["virtuals"]
  File "/usr/lib/portage/pym/portage_util.py", line 918, in __getitem__
    return value_callable(*pargs, **kwargs)
  File "/usr/lib/portage/pym/portage_util.py", line 902, in __call__
    self._value = self._callable(*self._pargs, **self._kwargs)
  File "/usr/lib/portage/pym/portage.py", line 2512, in getvirtuals
    self.treeVirtuals = map_dictlist_vals(getCPFromCPV,temp_vartree.get_all_provides())
  File "/usr/lib/portage/pym/portage.py", line 6690, in get_all_provides
    for node in self.getallcpv():
  File "/usr/lib/portage/pym/portage.py", line 6724, in getallcpv
    return self.dbapi.cpv_all()
  File "/usr/lib/portage/pym/portage.py", line 6356, in cpv_all
    for y in listdir(basepath+x,EmptyOnError=1):
  File "/usr/lib/portage/pym/portage.py", line 290, in listdir
    list, ftype = cacheddir(mypath, ignorecvs, ignorelist, EmptyOnError, followSymlinks)
  File "/usr/lib/portage/pym/portage.py", line 231, in cacheddir
    raise portage_exception.PermissionDenied(mypath)
portage_exception.PermissionDenied: /var/db/pkg/lost+found


Reproducible: Always

Steps to Reproduce:
1. Move the /var/db/pkg/ tree on separate partition
2. Run 'equery list foo' under unprivileged account
Comment 1 Martin Kampas 2008-02-28 12:16:27 UTC
Portage 2.1.4.4 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.23-gentoo-r8 i686)
=================================================================
System uname: 2.6.23-gentoo-r8 i686 AMD Sempron(tm) Processor 2800+
Timestamp of tree: Tue, 26 Feb 2008 19:16:01 +0000
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.4
dev-lang/python:     2.5.1-r5
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -finline-functions -march=k8 -msse2 -m3dnow -mmmx -mfpmath=sse -pipe"
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/kde/4.0/env /usr/kde/4.0/share/config /usr/kde/4.0/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/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/splash /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -finline-functions -march=k8 -msse2 -m3dnow -mmmx -mfpmath=sse -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://ftp.sh.cvut.cz/MIRRORS/gentoo/gentoo/ http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LC_ALL="cs_CZ.UTF-8"
PKGDIR="/usr/portage/packages"
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/martyone"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow X a52 acl alsa apache2 arts bash-completion berkdb bitmap-fonts bzip2 cli cracklib crypt cscope cups dbus dri encode exif fbcon flac fortran ftp gcj gdbm gif glitz gpm iconv imagemagick imap isdnlog jabber jack java jikes jingle jpeg kde mad midi mime mmx mp3 mpeg mudflap ncurses nls nptl nptlonly nvidia ogg opengl openmp pam pcre pdf perl png pppd python qt qt3 qt4 quicktime readline reflection session slang spl sse sse2 ssl subversion svg tcpd theora tiff truetype truetype-fonts type1-fonts unicode usb v4l vorbis wifi win32codecs x86 xorg xosd xpm xv xvid 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 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" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LDFLAGS, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Paul Varner (RETIRED) gentoo-dev 2008-02-28 15:20:59 UTC
dev-portage:

The traceback is coming from portage. Do I need to do something different in gentoolkit or is this a bug that you need to fix?
Comment 3 Zac Medico gentoo-dev 2008-02-28 17:13:06 UTC
The PermissionDenied error needs to be handled by gentoolkit. For compatibility with portage-2.2 I suggest something like this:

try:
 import portage.exception as portage_exception
except ImportError:
 import portage_exception

try:
 # do stuff with portage api
except portage_exception.PermissionDenied, e:
 # handle error
Comment 4 Paul Varner (RETIRED) gentoo-dev 2008-02-28 23:46:26 UTC
Zac: Thanks! I stole the code from emerge to fix.

$ svn commit -m "Fix traceback when accessing the portage db. (Bug #211716)" ChangeLog src/gentoolkit/__init__.py
Sending        ChangeLog
Sending        src/gentoolkit/__init__.py
Transmitting file data ..
Committed revision 477.
Comment 5 Paul Varner (RETIRED) gentoo-dev 2008-04-24 02:32:50 UTC
Released in gentoolkit-0.2.4_rc4