Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

Perl on Ubuntu 16.04 does not inherit exported shell functions #179

Closed
junghans opened this issue May 16, 2016 · 10 comments
Closed

Perl on Ubuntu 16.04 does not inherit exported shell functions #179

junghans opened this issue May 16, 2016 · 10 comments
Labels

Comments

@junghans
Copy link
Member

junghans commented May 16, 2016

The perl behavior on Ubuntu 16.04 (perl-5.22.2-1) has changed:

$ 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 early versions (e.g. Ubuntu 14.04):

$ bash
$ fct() { echo "Hello from within function";}
$ export -f fct
$ perl -e '$x=`bash -c "fct"`; print $x'
Hello from within function

However on Fedora 23 (perl-5.22.1) and Gentoo (perl-5.22.2) it works as expected.

This was found by a user here: https://groups.google.com/d/msg/votca/MnIiwjO3iC4/ceda5If3AgAJ

@junghans junghans added the bug label May 16, 2016
@junghans
Copy link
Member Author

Debian upstream bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=824511

@shadowcat-mst
Copy link

Have you checked this isn't actually some sort of anti-shellshock-like-things mitigation in the shell rather than something specific to the perl build?

@junghans
Copy link
Member Author

It could well be something in bash itself, but hopefully Debian's Perl maintainer (@ntyni) will know.

@junghans
Copy link
Member Author

junghans commented May 17, 2016

@shadowcat-mst, good guess as @ntyni point out in #824511, this actually a problem in dash, which is used as /bin/sh, the issue is already reported as https://bugs.debian.org/814358!

A workaround is:

sudo ln -fs bash /bin/sh

@junghans junghans changed the title Perl on Ubuntu 16.04 does not inherit shell enviorment Perl on Ubuntu 16.04 does not inherit exported shell functions May 17, 2016
junghans added a commit that referenced this issue Aug 11, 2017
@junghans
Copy link
Member Author

Over a year later and the bug in debian is still not fixed, maybe we should just change the 5 affected perl scripts (kbibi_ramp_correction.pl, lj_126.pl, pressure_cor_simple.pl,
pressure_cor_wjk.pl and of course update_ibi_pot.pl) to not call csg_get_interaction_property() and csg_get_property() anymore.

junghans added a commit to votca/votca that referenced this issue Aug 12, 2017
@abrukhno
Copy link
Contributor

abrukhno commented Aug 13, 2017

Looks like it might be a bit more complicated than just csg_get_property() for kBT:
(but I certainly support the move!)

inverse $ git grep csg_get *pl
kbibi_ramp_correction.pl:my $kbt=csg_get_property("cg.inverse.kBT");
kbibi_ramp_correction.pl:my $int_start=csg_get_interaction_property("inverse.post_update_options.kbibi.start");
kbibi_ramp_correction.pl:my $int_stop=csg_get_interaction_property("inverse.post_update_options.kbibi.stop");
kbibi_ramp_correction.pl:my $ramp_factor=csg_get_interaction_property("inverse.post_update_options.kbibi.factor");
kbibi_ramp_correction.pl:my $r_min=csg_get_interaction_property("min");
kbibi_ramp_correction.pl:my $r_max=csg_get_interaction_property("max");
kbibi_ramp_correction.pl:my $delta_r=csg_get_interaction_property("step");
kbibi_ramp_correction.pl:my $r_ramp=csg_get_interaction_property("--allow-empty","inverse.post_update_options.kbibi.r_ramp");
lj_126.pl:my $max=csg_get_interaction_property("max");
lj_126.pl:my $min=csg_get_interaction_property("min");
lj_126.pl:my $delta_r=csg_get_interaction_property("step");
lj_126.pl:my $c12=csg_get_interaction_property("inverse.post_update_options.lj.c12");
lj_126.pl:my $c6=csg_get_interaction_property("inverse.post_update_options.lj.c6");
pressure_cor_simple.pl:my $kBT=csg_get_property("cg.inverse.kBT");
pressure_cor_simple.pl:my $max=csg_get_interaction_property("max");
pressure_cor_simple.pl:my $min=csg_get_interaction_property("min");
pressure_cor_simple.pl:my $delta_r=csg_get_interaction_property("step");
pressure_cor_simple.pl:my $scale_factor=csg_get_interaction_property("inverse.post_update_options.pressure.simple.scale");
pressure_cor_simple.pl:my $p_target=csg_get_interaction_property("inverse.p_target");
pressure_cor_wjk.pl:my $kBT=csg_get_property("cg.inverse.kBT");
pressure_cor_wjk.pl:my $max=csg_get_interaction_property("max");
pressure_cor_wjk.pl:my $min=csg_get_interaction_property("min");
pressure_cor_wjk.pl:my $delta_r=csg_get_interaction_property("step");
pressure_cor_wjk.pl:my $partDens=csg_get_interaction_property("inverse.particle_dens");
pressure_cor_wjk.pl:my $name=csg_get_interaction_property("name");
pressure_cor_wjk.pl:my $scale_factor=csg_get_interaction_property("inverse.post_update_options.pressure.wjk.scale");
pressure_cor_wjk.pl:my $p_target=csg_get_interaction_property("inverse.p_target");
skeleton.pl:my $kBT=csg_get_property("cg.inverse.kBT");
update_ibi_pot.pl:#my $pref=csg_get_property("cg.inverse.kBT");

@junghans
Copy link
Member Author

junghans commented Aug 13, 2017

I am on it - #218

@tdthatcher
Copy link

This bug seems to still persist in the ubuntu 18.04 package, votca-csg/bionic 1.4.1-1build1, but it looks like it's fixed in the 1.5 release in 19.04. Are there any plans for an 18.04 stable-release-update to the package to fix this? Otherwise, that leaves the 18.04 package fundamentally flawed...

@junghans
Copy link
Member Author

junghans commented Apr 5, 2019

Please ask the Ubuntu package maintainer to bump the version in 18.04, otherwise, sudo ln -fs bash /bin/sh.

@tdthatcher
Copy link

Please ask the Ubuntu package maintainer to bump the version in 18.04, otherwise, sudo ln -fs bash /bin/sh.

Thanks for the reply. That workaround isn't something viable in my environment, so I'll get ahold of the package maintainers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants