Bug#824511: Perl-5.22.2 does not inherit shell enviorment

Niko Tyni ntyni at debian.org
Tue May 17 15:06:21 UTC 2016


On Mon, May 16, 2016 at 04:07:42PM -0600, Christoph Junghans wrote:
> Package: perl
> Version: 5.22.2-1
> 
> The behavior when calling an exported shell function from whitin perl
> has changed in version 5.22.2
> 
> $ bash
> $ fct() { echo "Hello from within function";}
> $ export -f fct
> $ perl -e '$x=`bash -c "fct"`; print $x'
> bash: fct: command not found
> 
> In contrast in version 5.20.2-3
> $ bash
> $ fct() { echo "Hello from within function";}
> $ export -f fct
> $ perl -e '$x=`bash -c "fct"`; print $x'
> Hello from within function
> 
> On Fedora 23 (perl-5.22.1) and Gentoo (perl-5.22.2) everything works
> as expected.

Hi,

this has nothing to do with Perl. It's a change in dash (which is /bin/sh
on Debian and Ubuntu systems) 0.5.8, which now filters environment
variable names at startup. See <https://bugs.debian.org/814358>.

Note that perl optimizes the intervening /bin/sh away for simple commands:
  perl -e '$x=`bash -c fct`; print $x'
works but
  perl -e '$x=`bash -c "fct"`; print $x'
doesn't because it contains shell metacharacters (double quotes).

Python behaves similarly fwiw, as seen with
  python -c 'import os; os.system("bash -c fct")'

There's not much we can do on the Perl side. Do you want me to
merge this with #814358, or what should we do with this report?
-- 
Niko Tyni   ntyni at debian.org




More information about the Perl-maintainers mailing list