Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 237526 - sys-apps/portage: not being in portage group leads emerge -p to fail (permission denied on /var/lib/gentoo/news/news-local-portage.unread)
Summary: sys-apps/portage: not being in portage group leads emerge -p to fail (permiss...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-12 20:42 UTC by Marc Finet
Modified: 2009-01-19 21:24 UTC (History)
1 user (show)

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


Attachments
use grabfile() to appropriately generate a PermissionDenied exception (unread_exception.patch,1.53 KB, patch)
2008-09-13 18:15 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Finet 2008-09-12 20:42:55 UTC
I'm not in portage group and issuing a emerge -p fails with permition denied on 
/var/lib/gentoo/news/news-local-portage.unread

Reproducible: Always

Steps to Reproduce:
1. not being in portage group
2. emerge -vp sys-process/procps 

Actual Results:  
> emerge -p sys-process/procps

These are the packages that would be merged, in order:

Calculating dependencies  ... done!
[ebuild   R   ] sys-process/procps-3.2.7
Traceback (most recent call last):
  File "/usr/bin/emerge", line 18, in <module>
    retval = _emerge.emerge_main()
  File "/usr/lib64/portage/pym/_emerge/__init__.py", line 13666, in emerge_main
    display_news_notification(root_config, myopts)
  File "/usr/lib64/portage/pym/_emerge/__init__.py", line 10720, in display_news_notification
    portdb, vardb, NEWS_PATH, UNREAD_PATH, repo, update=update)
  File "/usr/lib64/portage/pym/_emerge/__init__.py", line 10909, in checkUpdatedNewsItems
    return manager.getUnreadItems( repo_id, update=update )
  File "/usr/lib64/portage/pym/portage/news.py", line 142, in getUnreadItems
    f = open(unreadfile)
IOError: [Errno 13] Permission denied: '/var/lib/gentoo/news/news-local-portage.unread'
>

Expected Results:  
> emerge -p sys-process/procps

These are the packages that would be merged, in order:

Calculating dependencies           ... done!
[ebuild   R   ] sys-process/procps-3.2.7
>

I never tried to emerge something not being root/not in portage (bad thing so i do not know if this pb is recent or not).

> emerge --info
Portage 2.2_rc8 (default/linux/amd64/2008.0/desktop, gcc-4.2.3, glibc-2.8_p20080602-r0, 2.6.25-gentoo-r4cyann x86_64)
=================================================================
System uname: Linux-2.6.25-gentoo-r4cyann-x86_64-AMD_Sempron-tm-_Processor_3000+-with-glibc2.2.5
Timestamp of tree: Fri, 05 Sep 2008 21:18:01 +0000
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7, 2.1.6-r1
dev-lang/python:     2.4.4-r4, 2.5.2-r7
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.5
sys-apps/sandbox:    1.2.18.1-r3
sys-devel/autoconf:  2.13, 2.62-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1-r1
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   2.2.4
virtual/os-headers:  2.6.26
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8 -O2 -pipe -Wall"
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/config /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=k8 -O2 -pipe -Wall"
DISTDIR="/usr/portage/distfiles"
FEATURES="candy distlocks moo parallel-fetch preserve-libs sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.switch.ch/mirror/gentoo/"
LANG="C"
LC_ALL="C"
LDFLAGS="-Wl,-O1"
LINGUAS="en_GB en_US en fr fr_FR"
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/layman/pro-audio /usr/local/portage"
SYNC="rsync://rsync.fr.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac aalib acl acpi alsa amd64 bash-completion bitmap-fonts bluetooth branding bzip2 cairo cdparanoia cdr cli colordiff cracklib crypt cscope cups curl d dbus dga directfb dri dvd dvdr dvdread emboss encode evo exif fam fbdev firefox flac fortran gdbm gif glitz gphoto2 gpm gstreamer gtk gtk2 hal iconv ipv6 isdnlog jack jackmidi jpeg kde kerberos ladspa libcaca libnotify live lm_sensors mad matroska midi mikmod mmx mmxext mp3 mpeg msn mudflap multilib multiuser ncurses nethack nls nptl nptlonly nsplugin ntfs objc ogg oggvorbis opengl pam pcre pdf perl png ppds pppd prediction python qt3 qt3support qt4 quicktime readline reflection rtsp sdl sensord session spell spl sse sse2 ssl startup-notification stream svg sysfs tcpd theora threads tiff truetype truetype-fonts type1-fonts unicode usb userlocales vorbis wifi wxwindows x264 xml xorg xv xvid xvmc 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="canon ptp2" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB en_US en fr fr_FR" USERLAND="GNU" VIDEO_CARDS="vesa vga via fbdev"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Zac Medico gentoo-dev 2008-09-13 17:59:58 UTC
Please post the output of this command:

 ls -l /var/lib/gentoo/news/news-local-portage.unread

Looking at the code, it seems like it sets the mode to 0664, which should allow it to be read by anyone. Also please check permissions on the parent directories:

 ls -ld /var/lib/gentoo/news /var/lib/gentoo /var/lib /var
Comment 2 Zac Medico gentoo-dev 2008-09-13 18:15:25 UTC
Created attachment 165355 [details, diff]
use grabfile() to appropriately generate a PermissionDenied exception

If this patch is saved as /tmp/unread_exception.patch, then it can be applied as follows:

patch /usr/lib/portage/pym/portage/news.py /tmp/unread_exception.patch
Comment 3 Marc Finet 2008-09-13 19:26:42 UTC
#1: seems that file has 660 rights, not 664 (do you need more info ?)

$ ls -ld /var/lib/gentoo/news /var/lib/gentoo /var/lib /var /var/lib/gentoo/news/news-local-portage.unread
drwxr-xr-x 15 root root    4096 2008-05-08 12:53 /var
drwxr-xr-x 29 root root    4096 2008-09-03 07:16 /var/lib
drwxr-xr-x  3 root root    4096 2008-06-26 07:58 /var/lib/gentoo
drwxrwsr-x  2 root portage 4096 2008-09-13 21:16 /var/lib/gentoo/news
-rw-rw----  1 root portage    0 2008-08-11 19:06 /var/lib/gentoo/news/news-local-portage.unread


#2: but at least patch helps output:
Permission denied: '/var/lib/gentoo/news/news-local-portage.unread'
(instead of Python stack).

Now i do not know what is the policy regarding emerge, i.e. what should be done when not being in portage group. At least with attached patch it does not look weird.
Comment 4 Zac Medico gentoo-dev 2008-09-21 23:46:37 UTC
(In reply to comment #2)
> Created an attachment (id=165355) [edit]
> use grabfile() to appropriately generate a PermissionDenied exception

This patch is in 2.2_rc9.

I'm still not sure why you unread file doesn't have correct permissions. Maybe it has something to do with eselect-news.
Comment 5 Marc Finet 2008-09-24 18:24:20 UTC
Ok with 2.2_rc9 (nice "permission denied").

Now i do not know if this bug could be closed or not given permissions of files. In fact it seems that layman (i use for proaudio overlay) had a role in those permissions (or maybe it's just an old portage that set wrong permissions and newer portage overwrite those who have correct permissions...)
-rw-rw-r--  1 root portage    1 Sep 24 20:21 /var/lib/gentoo/news/news-gentoo.skip
-rw-rw-r--  1 root portage    0 Jun 26 08:13 /var/lib/gentoo/news/news-gentoo.unread
-rw-rw----  1 root portage    0 Aug 11 19:06 /var/lib/gentoo/news/news-local-portage.unread
-rw-rw----  1 root portage    0 Aug 11 19:08 /var/lib/gentoo/news/news-proaudio.unread
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2009-01-16 03:58:21 UTC
*** Bug 255101 has been marked as a duplicate of this bug. ***
Comment 7 Zac Medico gentoo-dev 2009-01-19 21:24:40 UTC
Like bug 255101, it seems like this one should be fixed in 2.1.6.7 and 2.2_rc23. Please reopen if you still have permissions issues.