[Koha-devel] Inconsistent Perl shebangs (new coding guideline?)
Fridolin SOMERS
fridolin.somers at biblibre.com
Tue Oct 13 10:05:01 CEST 2020
+1
Whould be nice for non-Debian OS possibility, and multi-perl installs.
On 13/10/2020 01:19, dcook at prosentient.com.au wrote:
> 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/
>
--
Fridolin SOMERS <fridolin.somers at biblibre.com>
Software and system maintainer 🦄
BibLibre, France
More information about the Koha-devel
mailing list