[Koha-devel] Inconsistent Perl shebangs (new coding guideline?)

Renvoize, Martin martin.renvoize at ptfs-europe.com
Tue Oct 13 16:59:52 CEST 2020


My vague recollection of such a conversation was summarized in this post:
https://jmmv.dev/2016/09/env-considered-harmful.html

I'm generally pro /usr/bin/env but they do make some good points in the
above that are worth consideration.

*Martin Renvoize*

<https://www.ptfs-europe.com>

Development Team Manager

Community Release Manager (19.11, 20.05)


*Phone:* +44 (0) 1483 378728

*Mobile:* +44 (0) 7725 985 636

*Email:* martin.renvoize at ptfs-europe.com

*Fax:* +44 (0) 800 756 6384


www.ptfs-europe.com







Registered in the United Kingdom No. 06416372   VAT Reg No. 925 7211 30

The information contained in this email message may be privileged,
confidential and protected from disclosure. If you are not the intended
recipient, any dissemination, distribution or copying is strictly
prohibited. If you think that you have received this email message in
error, please email the sender at info at ptfs-europe.com




On Tue, 13 Oct 2020 at 10:09, Jonathan Druart <
jonathan.druart at bugs.koha-community.org> wrote:

> I vaguely remember I had this discussion with someone, somewhere.
> And I have been told it was not a good idea.
> But I cannot remember why, who, where...
>
> Le mar. 13 oct. 2020 à 01:19, <dcook at prosentient.com.au> a écrit :
> >
> > Hi all,
> >
> >
> >
> > I was looking at “Bug 20582 - Turn Koha into a Mojolicious application”
> when I noticed that some of the scripts were using “#!/usr/bin/env perl”
> instead of “#!/usr/bin/perl”. While there is no requirement in the Coding
> Guidelines to use “#!/usr/bin/perl”, I thought it would be best for all our
> Perl scripts to be consistent.
> >
> >
> >
> > However, now I’m weighing up the options.
> >
> >
> >
> > Conceptually, using “#!/usr/bin/env perl” means that we can use
> perlbrew/plenv (or manually provide a different Perl in our $PATH) when
> running these scripts, so that we don’t have to use the system Perl located
> at /usr/bin/perl.
> >
> >
> >
> > That said, I was concerned about how most CGI scripts have
> “#!/usr/bin/perl” in them and the implications that might have if we
> invoked Starman/Morbo/Hypnotoad with a different Perl, but looking at
> Plack::App::CGIBin, CGI::Emulate::PSGI, Plack::App::WrapCGI, CGI::Compile,
> and Koha::App::Plugin::CGIBinKoha makes me think that the shebang in CGI
> scripts is ignored when using these Perl application servers, since they’re
> just read as Perl code and not handed to the exec() family of kernel
> syscalls.
> >
> >
> >
> > Starman/Morbo/Hypnotoad have been installed with /usr/bin/perl shebangs,
> so they’ll use the system Perl by default, but I think if they were
> installed using plenv and Carton for instance that they’d have their
> shebangs rewritten appropriately. We could also invoke
> Starman/Morbo/Hypnotoad with the version of Perl that we desire.
> >
> >
> >
> > So ultimately… I suppose the most reasonable thing to do is probably to
> mandate “#!/usr/bin/perl” for all Koha Perl scripts? If someone does want
> to use a different Perl, I suppose the onus is on them to make sure they
> execute Koha Perl scripts with a different Perl binary?
> >
> >
> >
> > Also, do people think there is a point in repairing existing Koha Perl
> scripts that have ‘#!/usr/bin/env perl’ instead of ‘#!/usr/bin/perl’?
> >
> >
> >
> > Cheers,
> >
> >
> >
> > David Cook
> >
> > Software Engineer
> >
> > Prosentient Systems
> >
> > 72/330 Wattle St
> >
> > Ultimo, NSW 2007
> >
> > Australia
> >
> >
> >
> > Office: 02 9212 0899
> >
> > Online: 02 8005 0595
> >
> >
> >
> > _______________________________________________
> > Koha-devel mailing list
> > Koha-devel at lists.koha-community.org
> > https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> > website : http://www.koha-community.org/
> > git : http://git.koha-community.org/
> > bugs : http://bugs.koha-community.org/
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20201013/3c00fc82/attachment.htm>


More information about the Koha-devel mailing list