retitle 824511 perl: shell execution removes exported bash functions block 824511 with 814358 thanks
(Please keep 824...@bugs.debian.org cc'd on replies) On Tue, May 17, 2016 at 11:25:26AM -0600, Christoph Junghans wrote: > 2016-05-17 9:06 GMT-06:00 Niko Tyni <nt...@debian.org>: > > 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 > > 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>. > Ok, doing > $ sudo ln -fs bash /bin/sh > helps! Yeah, that's a viable workaround. > > 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). > Thanks for the information, dropping the quotes works, however in our > case it is a bit more complicated as the fct() takes an argument. > E.g. > >> $ bash > >> $ fct() { echo "Hello from within function: args $@";} > >> $ export -f fct > >> $ perl -e '$x=`bash -c "fct 1 2 3"`; print $x' > Do you have a trick for that, too? Sorry, no more tricks I'm afraid :) > > 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? > Please merge the reports! Elsewhere it was suggested to me that we keep this against perl and mark it as blocked by the dash one. I suppose it would be possible to make perl use /bin/bash instead of /bin/sh if dash doesn't get fixed. (I'm not exactly thrilled about that option though.) So leaving the bug here at least for now, hope that's OK by you. -- Niko Tyni nt...@debian.org