Re: Bug#762839: bash without importing shell functions from the environment
Brian May <brian@microcomaustralia.com.au> writes:
> On 26 September 2014 12:08, Russ Allbery <rra@debian.org> wrote:
>>
>> I think you have that backwards, don't you? Shouldn't that be:
>>
>> echo='() { /bin/echo bar; }' sudo bash
> I think sudo treats both as the same/similar thing.
That would surprise me. In one case, you're setting an environment
variable and then running sudo. In the other case, you're telling sudo to
run the command "echo='() { /bin/echo bar; }' echo foo" via a shell. In
other words, with your original command, the actual command that you're
running with sudo is probably something like:
/bin/bash -e "echo='() { /bin/echo bar; }' echo foo"
and sudo itself never sees your environment setting.
sudo controls whether it's willing to pass arbitrary environment variables
to the command it runs with the env_reset, env_keep, and env_check
options.
--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>
Reply to: