Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 437350

Summary: net-p2p/deluge-1.3.5 init.d script does not apply DELUGED_OPTS
Product: Gentoo Linux Reporter: Craig Andrews <candrews>
Component: Current packagesAssignee: Paolo Pedroni <paolo.pedroni>
Severity: normal CC: candrews, heissfuss, julian, net-p2p
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---

Description Craig Andrews gentoo-dev 2012-10-05 21:30:55 UTC
/etc/init.d/deluged does not apply DELUGED_OPTS because it's quoted and should not be.

The line currently reads:
--exec /usr/bin/deluged -e HOME=${DELUGED_USER_HOME} -- --do-not-daemonize "${DELUGED_OPTS}"
it should read:
--exec /usr/bin/deluged -e HOME=${DELUGED_USER_HOME} -- --do-not-daemonize ${DELUGED_OPTS}

With the quoted ${DELUGED_OPTS}, deluged ignore the opts.

Reproducible: Always

# emerge --info
Portage (default/linux/amd64/10.0, gcc-4.7.2, glibc-2.15-r3, 3.5.4-gentoo x86_64)
System uname: Linux-3.5.4-gentoo-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9550_@_2.83GHz-with-gentoo-2.2
Timestamp of tree: Fri, 05 Oct 2012 13:45:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
ccache version 3.1.8 [enabled]
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.12
dev-lang/python:          2.7.3-r2, 3.2.3-r1
dev-util/ccache:          3.1.8
dev-util/cmake:           2.8.9-r1
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.10.5
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.10.3, 1.11.6, 1.12.4
sys-devel/binutils:       2.22.90
sys-devel/gcc:            4.7.2
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.6 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo openrc webapp-experimental sabayon sunrise x-portage
ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer -flto"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.0/conf"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe -fomit-frame-pointer -flto"
EMERGE_DEFAULT_OPTS="--jobs=4 --load-average=4.5"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parallel-install protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch usersandbox webrsync-gpg xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -flto"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/var/lib/layman/openrc /var/lib/layman/webapps-experimental /var/lib/layman/sabayon /var/lib/layman/sunrise /usr/local/portage"
USE="X a52 aac aacs acl acpi aiglx alsa amd64 amr amrnb amrwb animation apache2 apng artworkextra asf aspnet2 asyncns authdaemond avahi avi bash-completion bcmath berkdb bitmap-fonts bluetooth bluray bmp bonjour bzip2 cairo caps ccache cdda cddb cdparanoia cdr chm cli consolekit cracklib crypt cryptsetup css cups curl cxx daap dbus device-mapper dga dirac divx4linux dlloader dovecot-sasl dpms dri dts dv dvb dvd dvdr dvdread enca encode exif faac fam fame fat fbcondecor fbsplash ffmpeg fftw firefox flac fontconfig foomaticdb fortran freetype ftp gaim gd gdbm geoip gif gimpprint glamor gles glib glibc-omitfp glitz glut gnome gphoto2 gpm gsm gstreamer gstreamer10 gtk gtk2 hardenedphp hbci howl howl-compat https iconv idn imagemagick imap imlib innodb ipv6 java java5 jbig joystick jpeg jpeg2k junit kdehiddenvisibility kvm lapack lcms libfame libkms libnotify libsamplerate libusb lirc live lm_sensors lzma lzo mad maildir mdnsresponder-compat mjpeg mmap mms mmx mmxext mng modules mono motif mozilla mozsvg mp3 mpeg mpeg2 mplayer mudflap multilib musepack mysql mythtv ncurses nemesi network nls nptl nptlonly ntfs offensive ofx ogg oggvorbis openal opencl openexr opengl openmp openvg pam pango pcre pdf pdflib perl phonon pic pie png pnp policykit ppd ppds pppd pulseaudio python qt qt3 qt3support qt4 quicktime rar readline resolvconf rtc rtmp samba schroedinger screensaver sctp sdl session sharedmem shout sna sni snmp sox speex spell sqlite sse sse2 sse3 ssl ssse3 suspend2 svg tcpd theora threads tiff tls transcode truetype truetype-fonts type-fonts udev udisks unicode unzip upnp ups usb uxa v4l2 vaapi vcd vdpau videos vorbis vpx wayland webdav webservices wifi wmf wv x264 xa xanim xattr xcb xcomposite xinerama xml xml2 xpm xprint xrandr xv xvid xvmc zeroconf zip zlib" ALSA_CARDS="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 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 auth_digest proxy proxy_ajp proxy_connect proxy_http reqtimeout cgi" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CURL_SSL="nss" 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 joystick keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" LIRC_DEVICES="userspace" PHP_TARGETS="php5-4" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="jruby ruby19" USERLAND="GNU" VIDEO_CARDS="intel" 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"
USE_PYTHON="2.7 3.2"
Comment 1 Alex Belykh 2012-11-15 13:20:00 UTC
I have stumbled upon this too. I also suggest to quote ${DELUGED_USER_HOME}, b/c it can legitimately contain spaces. This leaves us with this line:

--exec /usr/bin/deluged -e HOME="${DELUGED_USER_HOME}" -- --do-not-daemonize ${DELUGED_OPTS}
Comment 2 Heiss 2013-01-26 06:26:03 UTC
Also, DELUGED_OPTS is not listed in the default /etc/conf.d/deluge, so users need to read the init script to find the variable name.
Comment 3 Benda Xu gentoo-dev 2013-04-01 08:24:34 UTC
Hi candrews, Could you please paste your /etc/conf.d/deluged?

In my case,

# grep D_OPTS /etc/conf.d/deluged 
DELUGED_OPTS="-p 11111"

# rc-service deluged restart
 * Stopping Deluged ... 
 * Starting Deluged ...  

# ps ax | grep deluged
10040 ?        Ssl    0:00 /usr/bin/python2.7 /usr/bin/deluged --do-not-daemonize -p 11111

$DELUGED_OPTS is counted.
Comment 4 Benda Xu gentoo-dev 2013-04-01 08:27:34 UTC
(In reply to comment #1)
> I have stumbled upon this too. I also suggest to quote ${DELUGED_USER_HOME},
> b/c it can legitimately contain spaces. This leaves us with this line:
> --exec /usr/bin/deluged -e HOME="${DELUGED_USER_HOME}" -- --do-not-daemonize

I have quoted this. Thanks.
Comment 5 Benda Xu gentoo-dev 2013-04-01 08:28:01 UTC
(In reply to comment #2)
> Also, DELUGED_OPTS is not listed in the default /etc/conf.d/deluge, so users
> need to read the init script to find the variable name.

Added an example of DELUGED_OPTS to conf.d/deluged, thanks.
Comment 6 Craig Andrews gentoo-dev 2013-04-05 19:57:04 UTC
(In reply to comment #3)
$ cat /etc/conf.d/deluged 
# /etc/conf.d/deluged
# Change this to the user you want to run deluged as.
# You may specify a group too, after a colon
DELUGED_OPTS="-l /var/log/deluge.log -L info"
Comment 7 Benda Xu gentoo-dev 2013-04-06 06:55:19 UTC
(In reply to comment #6)

> DELUGED_OPTS="-l /var/log/deluge.log -L info"

and this line is not applied?
Comment 8 Alex Belykh 2013-04-16 17:24:59 UTC
> # ps ax | grep deluged
> 10040 ?        Ssl    0:00 /usr/bin/python2.7 /usr/bin/deluged --do-not-daemonize -p 11111

> $DELUGED_OPTS is counted.

This is not an adequate test by any measure. ps doesn't show the difference between, e.g. 

deluged -l 11111 -L deluged.log


deluged "-l 11111 -L deluged.log"

I think the difference should be obvious already, but just to point it out, in the former case deluged executable gets 4 arguments, whereas in the latter it gets one monolithic argument "-l 11111 -L deluged.log", which it is unable to parse.

Deluge chokes on the unparseable option and doesn't really apply it, but still marches on, which is why you don't see any difference. But if you really do run the above two commands, you'll notice that the latter command doesn't create "deluged.log" in current directory.

This is the effect of quotes around DELUGED_OPTS, and it should be avoided. So, as I've been saying before, the line should read:

--exec /usr/bin/deluged -e HOME="${DELUGED_USER_HOME}" -- --do-not-daemonize ${DELUGED_OPTS}
Comment 9 Alex Belykh 2013-04-16 17:29:24 UTC
I made a copy-paste typo. "-l 11111" should read "-l debug"
Comment 10 Alex Belykh 2013-04-16 17:32:10 UTC
Gosh, I should get more sleep. Mixed case of -l and -L options. It should read "-L debug -l deluged.log"
Comment 11 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-02-16 18:22:44 UTC
commit f5049e856eb8a5811df3e7bcb6daf43875a88511
Author: Paolo Pedroni <>
Date:   Fri Feb 12 11:23:25 2016 +0100

    net-p2p/deluge: unquote ${DELUGED_OPTS} in openrc init file
    Fixes bug #437350. Thanks to Alex Belykh <>