Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 360813 - net-p2p/rtorrent-0.8.6-r1 should not use canonical USER variable in /etc/{init,conf}.d/rtorrent
Summary: net-p2p/rtorrent-0.8.6-r1 should not use canonical USER variable in /etc/{ini...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal major (vote)
Assignee: Gentoo net-p2p team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-27 18:00 UTC by Tim Bowers
Modified: 2011-04-11 21:49 UTC (History)
3 users (show)

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 Tim Bowers 2011-03-27 18:00:11 UTC
Init script shows that --user passed to start-stop-daemon is defined within /etc/conf.d/rtorrentd

However, no matter what this setting is, the screen session is generated by root instead (and so only root can control it).




Reproducible: Always

Steps to Reproduce:
1. edit /etc/conf.d/rtorrent to show USER="your_user"
2. start init script for rtorrent
3. screen -ls shows no sessions for "your_user"
4. confirm screen has started as root - sudo screen -ls - shows rtorrent session running.
Actual Results:  
Screen session owned by root is running rtorrent process

Expected Results:  
screen session should be created by user defined in /etc/conf.d/rtorrent

Possible fix would be to edit --exec to su - $user_defined_in_conf <rest of exec line>

Using $USER is a BAD(tm) idea. This is built in bash varible, will always return the user who ran the init script (root?), however I tested by changing the name of the variable and still get the same issue.

tim@MushaV2 ~ $ emerge --info
Portage 2.1.9.42 (!../usr/portage/profiles/default/linux/amd64/10.0, gcc-4.4.5, glibc-2.11.3-r0, 2.6.36-gentoo-r5 x86_64)
=================================================================
System uname: Linux-2.6.36-gentoo-r5-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4600+-with-gentoo-1.12.14
Timestamp of tree: Sun, 27 Mar 2011 01:15:01 +0000
distcc[2049] (dcc_set_trace_from_env) ERROR: failed to open logfile /var/log/distcc.log: Permission denied [disabled]
ccache version 2.4 [disabled]
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r3
dev-lang/python:     2.6.6-r2, 3.1.3-r1
dev-util/ccache:     2.4-r9
dev-util/cmake:      2.8.4
sys-apps/baselayout: 1.12.14-r1
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.5
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64-sse3 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=athlon64-sse3 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news nodoc noinfo parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="ftp://mirror.bytemark.co.uk/gentoo/ http://mirror.bytemark.co.uk/gentoo/ rsync://mirror.bytemark.co.uk/gentoo/ ftp://mirror.qubenet.net/mirror/gentoo/ http://mirror.qubenet.net/mirror/gentoo/ rsync://rsync.mirrorservice.org/www.ibiblio.org/gentoo/ http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/ ftp://ftp.mirrorservice.org/sites/www.ibiblio.org/gentoo/ ftp://gentoo.virginmedia.com/sites/gentoo http://gentoo.virginmedia.com/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_GB en"
MAKEOPTS="-j5"
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="/home/tim/.portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.uk.gentoo.org/gentoo-portage"
USE="aac acl acpi alsa amd64 amr apache2 avi berkdb bzip2 cli consolekit cracklib crypt cups cxx daemon dbus dri embedded extensions extras ffmpeg fortran gdbm gpm gstreamer iconv jpeg mmx modules moonlight mp3 mpeg mudflap multilib ncurses nls nptl nptlonly openmp pam pcre perl png policykit pppd python qt3support readline sdl session sse sse2 ssl sysfs tcpd unicode xorg xulrunner xvid zlib" ALSA_CARDS="snd-hda-intel" 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 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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" 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="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nv nvidia" XFCE_PLUGINS="menu" 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, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

TESTING:
tim@MushaV2 ~ $ cat /etc/conf.d/rtorrentd 
poopoohead="tim"

depend() {
	use net ypbind nis
	after slapd mysqld postgresql
}

start() {
	PWHOME="$(getent passwd $poopoohead | awk -F: '{ print $6 }')"

	ebegin "Starting rtorrent"
	echo ${poopoohead}
	env TERM="xterm" \
		start-stop-daemon \
			--start \
			--user $poopoohead \
			--env HOME="${PWHOME:-/home/$poopoohead}" \
			--name rtorrent \
			--exec /usr/bin/screen -- -dmS rtorrentd /usr/bin/rtorrent
	eend $?
}

--- Shows that init script is pulling correct info from conf file, however is ignored in execution of screen.
Comment 1 Tim Bowers 2011-03-29 07:15:42 UTC
I forgot to put that when the script runs, it does indeed echo the user specified in /etc/conf.d/rtorrent, but the screen session is then started by root - seemingly ignoring the whole --user arguement within the init script.
Comment 2 Stanislav Ochotnicky (RETIRED) gentoo-dev 2011-04-11 21:49:38 UTC
Thanks for bugreport. If you re-emerge 0.8.6-r1 and run etc-update this should be fixed hopefully. If not feel free to reopen this bug.