Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 327515 - app-portage/portage-utils-0.3.1: qlop -c fails when called with a uid != 0
Summary: app-portage/portage-utils-0.3.1: qlop -c fails when called with a uid != 0
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High minor
Assignee: Portage Utils Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-08 17:27 UTC by Malte Starostik
Modified: 2010-07-09 22:21 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 Malte Starostik 2010-07-08 17:27:51 UTC
When running qlop -c from a non-root account, it aborts on failure to read a current emerge's chroot.

Reproducible: Always

Steps to Reproduce:
1. start to emerge something
2. run qlop -c as a regular user
3. run qlop -c as root

Actual Results:  
malte@hal ~ $ qlop -c
 * media-video/kino-1.3.3
     started: Thu Jul  8 19:11:26 2010
     elapsed: 0 seconds
lop: readlink(/proc/8425/root) failed: Permission denied

If there is another emerge job running at the same time, it will be completely ignored as qlop aborts on the above error.

Expected Results:  
malte@hal ~ $ sudo qlop -c
 * media-video/kino-1.3.3
     started: Thu Jul  8 03:37:13 2010
     elapsed: 15 hours, 33 minutes, 58 seconds
     chroot:  /
 * dev-python/pygtk-2.16.0-r1
     started: Thu Jul  8 03:37:57 2010
     elapsed: 15 hours, 33 minutes, 14 seconds
     chroot:  /


FWIW, the user malte from the sample above is in the portage group and prior qlop versions didn't show this problem as they didn't show the chroot path.  Also please ignore the elapsed time values, the "Expected Results" output was actually taken before the "Actual Results" and the box had been suspended during the run of those jobs.  None of this affects the general problem though.

The obvious workaround is to run qlop -c as root, and the inability to read the processes' roots is natural.  Anyway that failure should probably not be fatal.

emerge --info:
Portage 2.2_rc67 (default/linux/amd64/10.0/desktop/kde, gcc-4.4.3, glibc-2.11.2-r0, 2.6.33-gentoo-r2-stellaware x86_64)
=================================================================
System uname: Linux-2.6.33-gentoo-r2-stellaware-x86_64-Intel-R-_Core-TM-2_Duo_CPU_E6750_@_2.66GHz-with-gentoo-1.12.13
Timestamp of tree: Wed, 07 Jul 2010 15:15:02 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:     4.0_p37
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.5-r2, 3.1.2-r3
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.3-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA AdobeFlash-10 AdobeFlash-10.1 dlj-1.1 googleearth PUEL"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /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/eselect/postgresql /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"
CXXFLAGS="-march=core2 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--jobs --load-average=3.0"
FEATURES="assume-digests distlocks fixpackages metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://de-mirror.org/distro/gentoo/"
LC_ALL="de_DE.utf8"
LDFLAGS="-Wl,-O1"
LINGUAS="de en"
MAKEOPTS="-j3 -l3"
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/crossdev /var/lib/layman/stellaware /var/lib/layman/sunrise"
SYNC="rsync://sync/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 amr avahi berkdb bluetooth branding bzip2 cairo cdr cli consolekit cracklib crypt cups curl cxx dbus dga djvu dri dts dv dvb dvd dvdr emboss encode exif ffmpeg firefox flac fontconfig fortran gdbm geoip gif gimp git gpm hal iconv icu inotify ipv6 java java6 jpeg jpeg2k kde lame lcms ldap libnotify libsamplerate lirc lm_sensors lzma mad matroska mikmod mmx mng mp3 mp4 mpeg msn mudflap multilib mysql ncurses nls nptl nptlonly nsplugin ogg openal opencore-amr openexr opengl openmp oscar pam pango pcre pdf perl plasma png postgres ppds pppd python qt3support qt4 quicktime readline reflection samba sdl semantic-desktop session smp snmp speex spell spl sqlite sse sse2 sse3 ssl startup-notification subversion svg sysfs tcpd themes theora threads tiff truetype unicode usb v4l v4l2 vcd vdpau vhosts vim-syntax vorbis webkit x264 xattr xcb xcomposite xine xml xmp xorg xosd xulrunner xv xvid xvmc yahoo zeroconf 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 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" CAMERAS="samsung" ELIBC="glibc" INPUT_DEVICES="evdev wacom" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de en" LIRC_DEVICES="atiusb" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LANG, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 solar (RETIRED) gentoo-dev 2010-07-09 05:45:46 UTC
SpanKY,

Looks like this is your bug. Reverting to just a plain readlink should be fine w/o checking the error codes. path would be NULL.

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?r1=1.49&r2=1.50
Comment 2 SpanKY gentoo-dev 2010-07-09 22:21:26 UTC
that wouldnt be correct either.  ive rewritten the usage a bit more:
http://sources.gentoo.org/gentoo-projects/portage-utils/qlop.c?r1=1.52&r2=1.53