EPICS Home

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  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021 
<== Date ==> <== Thread ==>

Subject: Re: Perl scripts shebang: /usr/bin/perl vs. /usr/bin/env perl
From: Torsten Bögershausen <torsten.bogershausen@esss.se>
To: "Konrad, Martin" <konrad@frib.msu.edu>, "J. Lewis Muir" <jlmuir@imca-cat.org>, "core-talk@aps.anl.gov" <core-talk@aps.anl.gov>
Date: Fri, 14 Sep 2018 13:54:57 +0200
A complete (?) different issue:

epics base 3.14:
commit 9051cdbb34429cc03867f5ec1be990d63c3193a9
Author: Andrew Johnson <anj@anl.gov>
Date:   Fri Aug 10 15:20:29 2018 -0500

    Added a simpler startup/EpicsHostArch for backwards-compatibility
[]

Could it be that  startup/EpicsHostArch is "broken" ?
The "[[" and "]]" are "bash-only".
The easiest fix would be to replace "[[" with "[" and "]]" with "]",
which works both in bash and in POSIX shells.

(I would love to send you a pull request, but I assume that the
 source of the source is still not on bitbucket ?)

--------------------------------------------------


#!/bin/sh
# Script to find and run the Perl EpicsHostArch.pl script.

# This script is provided for backwards-compatibility only and may be
# dropped from future releases of Base. Please adjust callers to run
# the Perl version directly as this startup directory isn't copied to
# INSTALL_LOCATION by the EPICS build system.

EHA=EpicsHostArch.pl

cd "$(dirname "$0")/.."

# Perl script will be installed into lib/perl
[[ -f lib/perl/$EHA ]] && exec perl lib/perl/$EHA $*

# If Base hasn't been built yet, use the source Luke
[[ -f src/tools/$EHA ]] && exec perl src/tools/$EHA $*

# Die with an error message
echo "$0: Can't find $EHA" >&2
exit 1



On 11/09/18 20:33, Konrad, Martin wrote:
Hi Lewis,
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
Thanks for pointing us to this thread. I would also prefer the former
for better robustness.

BTW: The Debian Policy Manual also prefers the former [1]. Plus, it says
the script name should not include the .pl extension if it gets
installed into a directory in the system PATH.

It's difficult to meet the sometimes contradictory requirements of all
supported platforms at the same time (Windows needs ".pl" extension
which is in conflict with the Debian Policy Manual). I world consider
some of this customization work the package maintainer's responsibility
(they decide into which directory a file gets installed, they can decide
to remove the file name extension etc).

For now I'm happy that we got rid of the

eval 'exec perl -S $0 ${1+"$@"}'  # -*- Mode: perl -*-
     if $running_under_some_shell;

craziness and that all Perl files start with some shebang line. That's
certainly a step into the right direction - for all platforms/users :-)

-Martin

[1] https://www.debian.org/doc/debian-policy/ch-files.html#scripts


Replies:
Re: Perl scripts shebang: /usr/bin/perl vs. /usr/bin/env perl Michael Davidsaver
References:
Re: Perl scripts shebang: /usr/bin/perl vs. /usr/bin/env perl Konrad, Martin

Navigate by Date:
Prev: Fwd: ATTN: CloudBees dev@CLOUD Sunset 12/15/18 Ralph Lange
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 
Navigate by Thread:
Prev: Re: Perl scripts shebang: /usr/bin/perl vs. /usr/bin/env perl Konrad, Martin
Next: Re: Perl scripts shebang: /usr/bin/perl vs. /usr/bin/env perl Michael Davidsaver
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021