On Tue 2017-01-03 17:06:00 -0500, Jameson Graef Rollins wrote:
> On Tue, Jan 03 2017, Daniel Kahn Gillmor <d...@fifthhorseman.net> wrote:
>> trying to build the rescue image on stretch/sid, i get:
>>
>> run-parts: executing rescue/modules/a0_motd
>> run-parts: executing rescue/modules/a0_prep-root
>> dpkg: warning: failed to open configuration file '/root/.dpkg.cfg' for 
>> reading: Permission denied
>> rescue/modules/a0_prep-root: line 32: debirf_info_sh: command not found
>> run-parts: rescue/modules/a0_prep-root exited with return code 127
>
> I can reproduce this.  It appears that the functions from
> /usr/share/debirf/common are no longer being executed to the modules,
> even though other environment variables are.  Why would the functions no
> longer be exported?  Is this due to a change in bash? run-parts?
> fakeroot?

This is a good question!  it looks to me like something is happening
between bash and fakeroot!  On a stretch/sid system:

0 dkg@alice:~$ unset -f foo
0 dkg@alice:~$ bash -c foo
bash: foo: command not found
127 dkg@alice:~$ foo() { echo bar; }
0 dkg@alice:~$ export -f foo
0 dkg@alice:~$ bash -c foo
bar
0 dkg@alice:~$ fakeroot bash -c foo
bash: foo: command not found
127 dkg@alice:~$ 


otoh, the same thing happens when i interject through other shells, but
not when i pass it through bash itself:

0 dkg@alice:~$ dash -c 'bash -c foo'
bash: foo: command not found
127 dkg@alice:~$ posh -c 'bash -c foo'
bash: foo: command not found
127 dkg@alice:~$ bash -c 'bash -c foo'
bar
0 dkg@alice:~$ 


bash caches these functions in the environment as BASH_FUNC_foo%%, but
somehow only transmits them to children:

0 dkg@alice:~$ printenv BASH_FUNC_foo%%
() {  echo bar
}
0 dkg@alice:~$ dash -c 'printenv BASH_FUNC_foo%%'
1 dkg@alice:~$ bash -c 'printenv BASH_FUNC_foo%%'
() {  echo bar
}
0 dkg@alice:~$ fakeroot printenv BASH_FUNC_foo%%
1 dkg@alice:~$ 


This is *not* the case on jessie systems:

[0 dkg@grunt ~]$ foo() { echo bar; }
[0 dkg@grunt ~]$ export -f foo
[0 dkg@grunt ~]$ bash -c foo
bar
[0 dkg@grunt ~]$ dash -c 'bash -c foo'
bar
[0 dkg@grunt ~]$ fakeroot bash -c foo
bar
[0 dkg@grunt ~]$ printenv BASH_FUNC_foo%%
() {  echo bar
}
[0 dkg@grunt ~]$ fakeroot printenv BASH_FUNC_foo%%
() {  echo bar
}
[0 dkg@grunt ~]$


So this definitely looks to me like we're running into a shellshock
countermeasure, but i don't understand the countermeasures well enough
to know how to proceed with a fix, other than explicitly sourcing the
predefined functions in each module.

any suggestions?

   --dkg

Attachment: signature.asc
Description: PGP signature

Reply via email to