EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Perl scripts shebang: /usr/bin/perl vs. /usr/bin/env perl
From: Benjamin Franksen <[email protected]>
To: <[email protected]>
Date: Mon, 5 Nov 2018 18:34:17 +0100
Am 11.09.18 um 18:55 schrieb J. Lewis Muir:
> Hi, all!
>
> I suggest that all EPICS-Base-installed Perl scripts should use an
> absolute path to the desired Perl interpreter in their shebang line
> rather than using env to invoke the interpreter.
>
> I'm reminded of this because of
>
>   https://epics.anl.gov/core-talk/2018/msg00443.php
>
> in which Martin Konrad wrote:
>
>> Looking at the Perl scripts included in EPICS Base I'm wondering if it
>> is really necessary to start some of them (see for example [1]) with the
>> rather esoteric
>>
>> eval 'exec perl -S $0 ${1+"$@"}'  # -*- Mode: perl -*-
>>     if $running_under_some_shell;
>>
>> rather than the usual "#!/usr/bin/perl" or "#!/usr/bin/env perl"
>
> I would much prefer the former over the latter, but it seems the latter
> is what has been chosen!  This was discussed on Tech-Talk in
>
>   https://epics.anl.gov/tech-talk/2013/msg00098.php
>
> but I'll just say again, I think the pathname of the Perl interpreter
> should be specified as a variable in an appropriate file under configure
> and for that to be used in the shebang line of all installed Perl
> scripts.  I would like scripts to work without requiring perl to be
> on the command search path, and I would like to be able to specify
> which perl is used for the scripts when they are installed rather than
> whatever perl is first on the command search path.  This way, the
> scripts do not rely on the command search path to find perl, and if
> multiple versions of Perl are installed, or if the perl that is first
> on the command search path changes, I can be sure that the installed
> scripts will continue to work.  For more on this opinion, see
>
>   http://julio.meroh.net/2016/09/env-considered-harmful.html

Disclaimer: I am not a core developer.

I agree with most of the things said on this page. In particular,
chosing the correct interpreter is not enough. You also need to have the
correct search path for the libraries. For Perl and the standard
libraries that come with it, this should be taken care of by the Perl
distribution, but as soon as you want to allow users to also install
libraries things become ugly because then you'll have to rely on things
like PERL5LIB being set correctly etc. (The only OS I am aware of that
allows system-wide installations by non-priviledged users without
compromising security is NixOS.) Anyway EPICS base uses only a small set
of Perl libraries that are part of all standard Perl distributions (or
provided by EPICS base itself) so this should not be an issue here.

Also, when we use Perl scripts in Makefiles we already call the
interpreter explicitly using the variable PERL defined in
configure/CONFIG_COMMON, so that would not be affected.

I think it should be stated explicitly that your proposal requires the
EPICS base build system to patch the shebang line in its Perl scripts
during or before install. And this also affects any EPICS modules
because they use the same build rules. Just saying.

Cheers
Ben

________________________________

Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Dr. Karl Eugen Huthmacher, stv. Vorsitzende Dr. Jutta Koch-Unterseher
Geschäftsführung: Prof. Dr. Bernd Rech (kommissarisch), Thomas Frederking

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin

https://www.helmholtz-berlin.de

Abonnieren Sie unseren monatlichen Newsletter!<https://www.helmholtz-berlin.de/aktuell/pm/newsletter/>
Subscribe to our monthly newsletter!<https://www.helmholtz-berlin.de/aktuell/pm/newsletter/index_en.html>

References:
Perl scripts shebang: /usr/bin/perl vs. /usr/bin/env perl J. Lewis Muir

Navigate by Date:
Prev: Re: Perl scripts shebang: /usr/bin/perl vs. /usr/bin/env perl Michael Davidsaver
Next: Re: Perl scripts shebang: /usr/bin/perl vs. /usr/bin/env perl Johnson, Andrew N. via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Perl scripts shebang: /usr/bin/perl vs. /usr/bin/env perl Johnson, Andrew N. via Core-talk
Next: Re: Perl scripts shebang: /usr/bin/perl vs. /usr/bin/env perl Konrad, Martin
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
ANJ, 05 Nov 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·