Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 349592 - sys-apps/openrc: document env cleansing in runscript(8)
Summary: sys-apps/openrc: document env cleansing in runscript(8)
Status: CONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-24 11:27 UTC by Plopmaster
Modified: 2016-05-03 08:06 UTC (History)
2 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 Plopmaster 2010-12-24 11:27:45 UTC
/etc/init.d/transmission-daemon is run with /sbin/runscript
This prevent environment variables to be transmitted to it, like http_proxy. If you use transmission with an Android client, it make impossible to send (url of) .torrent to the daemon (as the daemon can't access the web)
A workaround (bugfix ? ) is to run /etc/init.d/transmission-daemon with /sbin/runscript.sh

Reproducible: Always

Steps to Reproduce:
1. Put transmission behind a proxy. Be sure you can't access the web without passing through the proxy.
2. Put http_proxy=http://my-proxy:port in /etc/profile, or somewhere it's sourced by your shell
3. Take an Android, put a transmission-aware bittorrent client (like torrent-fu or transdroid). Set it up
4. Make a search with the Android, and send the result to your transmission.
Actual Results:  
Your torrent isn't being downloaded

Expected Results:  
You can download torrent with an Android client
Comment 1 Mike Gilbert gentoo-dev 2010-12-25 03:34:57 UTC
Try putting it in /etc/conf.d/transmission-daemon. For example.

echo "export http_proxy=http://my-proxy:port" >> /etc/conf.d/transmission-daemon
Comment 2 Peter Volkov (RETIRED) gentoo-dev 2011-02-12 01:22:40 UTC
Plopmaster, could you answer comment #1, please?
Comment 3 Plopmaster 2011-02-15 18:44:44 UTC
Sorry for the late ...
It works with that workaround.
Comment 4 Peter Volkov (RETIRED) gentoo-dev 2011-03-12 17:05:07 UTC
Plopmaster, do you use openrc? If so, could you, please, try set:

rc_env_allow="http_proxy"

I think this should add http_proxy to the whitelist of variable that runscript will sip to unset... 

void
env_filter(void)
{
...

        /* Add the user defined list of vars */
        env_allow = rc_stringlist_split(rc_conf_value("rc_env_allow"), " ");
...

        TAILQ_FOREACH(env, env_list, entries) {
...
                /* Check our user defined list */
                if (rc_stringlist_find(env_allow, env->value))
                        continue;

                /* OK, not allowed! */
                unsetenv(env->value);
        }

If this helps I'll ask our openrc guys to document this as this variable is not documented in runscript manual(8) page.
Comment 5 Plopmaster 2011-03-12 23:57:09 UTC
Sorry, I don't use openrc...
Comment 6 Peter Volkov (RETIRED) gentoo-dev 2011-03-14 06:34:49 UTC
Ok, I'll CC openrc in any case.

Guys does rc_env_allow is supposed to work as I described in comment 4? If so, could you document it, please? May be you know, does there exist similar mechanism for baselayout-1?
Comment 7 SpanKY gentoo-dev 2011-03-14 07:48:08 UTC
the init.d script is acting correctly.  nothing for the transmission maintainers to "fix" here.

use the method Peter described for openrc, or use /etc/conf.d/env_whitelist for baselayout-1 if you want to pass some vars.
Comment 8 Peter Volkov (RETIRED) gentoo-dev 2011-03-14 08:43:54 UTC
Mike, thank you. But is this documented anywhere? I think man runscript(8) is a good place but may be there are better.. Looking in google people mentioned this variable in our bugzilla but not in documentation.
Comment 9 SpanKY gentoo-dev 2011-03-14 21:33:50 UTC
that would be the best place for it.  probably want to mention runscript(8) in all the standard openrc config files too.
Comment 10 William Hubbs gentoo-dev 2011-04-08 18:26:18 UTC
The following information is in /etc/rc.conf:

# By default we filter the environment for our running scripts. To allow other
# variables through, add them here. Use a * to allow all variables through.
#rc_env_allow="VAR1 VAR2"

Since the rc.conf setting is documented, I'm not sure what needs to be
put in the runscript(8) man page.
Comment 11 Peter Volkov (RETIRED) gentoo-dev 2011-04-09 04:31:42 UTC
(In reply to comment #10)
> The following information is in /etc/rc.con=:
> 
> # By default we filter the environment for our running scripts. To allow other
> # variables through, add them here. Use a * to allow all variables through.
> #rc_env_allow="VAR1 VAR2"
> 
> Since the rc.conf setting is documented, I'm not sure what needs to be
> put in the runscript(8) man page.

Personally I'd preferred to have some reference in addition to comments configuration file. May be it's good idea to have rc.conf(5) manual page or at least to mention rc.conf comments in "SEE ALSO" section.