Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 364351 - app-portage/eix-0.22.8: eix-sync requires UID 0
Summary: app-portage/eix-0.22.8: eix-sync requires UID 0
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: x86 OS X
: Normal minor (vote)
Assignee: Martin Väth
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-21 13:59 UTC by Jacob Godserv
Modified: 2011-07-05 15:23 UTC (History)
1 user (show)

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


Attachments
eix-0.22.8.ebuild.patch (eix-0.22.8.ebuild.patch,721 bytes, patch)
2011-04-21 14:32 UTC, Jacob Godserv
Details | Diff
eix-rootuid.patch (eix-rootuid.patch,870 bytes, patch)
2011-04-21 14:33 UTC, Jacob Godserv
Details | Diff
eix-0.22.8.ebuild.patch (eix-0.22.8.ebuild.patch,1.03 KB, patch)
2011-04-22 15:46 UTC, Jacob Godserv
Details | Diff
eix-rootuid.patch (eix-rootuid.patch,1.41 KB, patch)
2011-04-22 15:47 UTC, Jacob Godserv
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jacob Godserv 2011-04-21 13:59:15 UTC
eix-sync requires UID 0 in order to run, unless I pass the -e argument. Like portage, it should understand a different UID as the super user (for the Prefix installation).

The work-around is to create the eix-sync configuration file as suggested by the eix-sync error output and write "-e" in it.

Reproducible: Always

Steps to Reproduce:
1. Execute prefixed eix-sync as a normal user.



 ~ $ emerge --info
Portage 2.2.01.18252-prefix (prefix/darwin/macos/10.6/x64, gcc-4.2.1, unavailable, 10.7.0 i386)
=================================================================
System uname: Darwin-10.7.0-i386-64bit
Timestamp of tree: Thu, 21 Apr 2011 11:39:37 +0000
distcc 3.1-toolwhip.1 i386-apple-darwin10.0 [disabled]
app-shells/bash:     4.1_p7
dev-lang/python:     2.7.1-r1
sys-devel/autoconf:  2.68
sys-devel/automake:  1.11.1
sys-devel/gcc-config: 1.4.1-r00.2
sys-devel/libtool:   2.4-r1
sys-devel/make:      3.82
virtual/os-headers:  0
Repositories: gentoo_prefix
Installed sets: 
ACCEPT_KEYWORDS="~x64-macos"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-apple-darwin10"
CFLAGS="-O2 -pipe -march=nocona"
CHOST="x86_64-apple-darwin10"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/portage /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=nocona"
DISTDIR="/Users/jacob/Gentoo/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs collision-protect distlocks fixlafiles fixpackages news nostrip parallel-fetch preserve-libs protect-owned sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-dead_strip_dylibs"
MAKEOPTS="-j2"
PKGDIR="/Users/jacob/Gentoo/usr/portage/packages"
PORTAGE_CONFIGROOT="/Users/jacob/Gentoo/"
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="/Users/jacob/Gentoo/var/tmp"
PORTDIR="/Users/jacob/Gentoo/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"
USE="aqua coreaudio cracklib cxx faac faad mmx mmxext modules mp3 ncurses nls objc objc++ prefix readline sse sse2 ssl theora unicode vorbis x264 x64-macos xvid zlib" 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 cgi cgid 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="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="Darwin" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse" KERNEL="Darwin" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Jacob Godserv 2011-04-21 14:32:41 UTC
Created attachment 270781 [details, diff]
eix-0.22.8.ebuild.patch

Suggested fix: configure "root" UID via portage's constants, which is aware of Prefix's super-user UID.
Comment 2 Jacob Godserv 2011-04-21 14:33:11 UTC
Created attachment 270783 [details, diff]
eix-rootuid.patch
Comment 3 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-04-21 15:40:43 UTC
Acceptable idea. Another option is that we could just install the config file for prefix only if it isn't accepted upstream.
Comment 4 Jacob Godserv 2011-04-21 18:17:39 UTC
(In reply to comment #3)
> Acceptable idea. Another option is that we could just install the config file
> for prefix only if it isn't accepted upstream.

How do I push this upstream?
Comment 5 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-04-21 18:25:05 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Acceptable idea. Another option is that we could just install the config file
> > for prefix only if it isn't accepted upstream.
> 
> How do I push this upstream?

I assigned this bug to upstream author of eix ;)
Comment 6 Martin Väth 2011-04-22 09:11:26 UTC
I would like to avoid the dependency on python and portage.
Would it be sufficient to add a ./configure option to pass the ROOT_UID
during compilation from the ebuild or _must_ the test be done at runtime?
Comment 7 Jacob Godserv 2011-04-22 12:16:22 UTC
(In reply to comment #6)
> I would like to avoid the dependency on python and portage.
> Would it be sufficient to add a ./configure option to pass the ROOT_UID
> during compilation from the ebuild or _must_ the test be done at runtime?

To be 100% correct, (to my surprise) the expression in the Makefile is evaluated during compilation, and results are hard-coded into the eix-sync binary.

Using ./configure to set the ROOT_UID was my first idea as well, but since I do not understand autotools' bracket-happy language just yet, and since I saw the Makefile also being used for configure-like operations, I went with the Makefile option instead.

I will attempt to write a different patch but no guarantees on that contribution coming sooner rather than later.
Comment 8 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-04-22 15:17:02 UTC
(In reply to comment #6)
> I would like to avoid the dependency on python and portage.
> Would it be sufficient to add a ./configure option to pass the ROOT_UID
> during compilation from the ebuild or _must_ the test be done at runtime?

Yup, we do that in the portage ebuilds themselves. Example, something like:

PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser')
<...>
--with-root-user="${PORTAGE_ROOT_USER}" \

Obviously, different for user vs uid. Just saying it has been done before.
Comment 9 Jacob Godserv 2011-04-22 15:46:29 UTC
Created attachment 270877 [details, diff]
eix-0.22.8.ebuild.patch

Here's a different version. This time, the UID is retrieved in the ebuild and passed to configure, then to Makefile, then hard-coded into eix-sync.
Comment 10 Jacob Godserv 2011-04-22 15:47:06 UTC
Created attachment 270879 [details, diff]
eix-rootuid.patch

I did this by example, so please review the configure patch particularly critically, as it may give the appearance of looking consistent and correct but not actually be so.
Comment 11 Martin Väth 2011-04-26 16:07:05 UTC
Thanks for the patch.
I added an extended version to the eix svn trunk (>=eix-0.22.9):

In your patch, AC_DEFINE_UNQUOTED(...) would be too much, because this defines
constants for the C++ code in config.h
However, I guess that the ROOT_UID should also be used for the ad-hoc
sanity checks of eix-update, so I left it there and modified eix-update
corrsepondingly.

Since it is now in C++ anyway, I decided to make ROOT_UID a "real" eix variable
which can be modified by the user after installation.
Consequently, I renamed the ./configure option into --with-root-uid-default
since now it only sets the default for ROOT_UID.
Comment 12 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-07-05 14:33:28 UTC
app-portage/eix-0.22.9 is in the tree
Comment 13 Jacob Godserv 2011-07-05 15:23:57 UTC
This is one of my favorite Bugzilla experiences; you guys are awesome. Thanks for the patience and interactions. :)