* [PATCH] #!/usr/bin/perl -> #!/usr/bin/env perl
@ 2019-09-24 20:43 Alyssa Ross
2019-09-26 2:49 ` Eric Wong
0 siblings, 1 reply; 6+ messages in thread
From: Alyssa Ross @ 2019-09-24 20:43 UTC (permalink / raw)
To: meta; +Cc: Alyssa Ross
It's much more reasonable to assume that the Perl a user wants to use
is the one they have in their path, rather than whatever one has been
installed system-wide by their distribution (if any!).
---
Documentation/extman.perl | 3 ++-
Documentation/standards.perl | 3 ++-
Makefile.PL | 3 ++-
certs/create-certs.perl | 2 +-
ci/deps.perl | 3 ++-
examples/cgit.psgi | 2 +-
examples/highlight.psgi | 2 +-
examples/newswww.psgi | 2 +-
examples/public-inbox.psgi | 2 +-
examples/unsubscribe.milter | 2 +-
examples/unsubscribe.psgi | 3 ++-
script/public-inbox-compact | 2 +-
script/public-inbox-convert | 2 +-
script/public-inbox-edit | 2 +-
script/public-inbox-httpd | 2 +-
script/public-inbox-index | 2 +-
script/public-inbox-init | 2 +-
script/public-inbox-learn | 2 +-
script/public-inbox-mda | 2 +-
script/public-inbox-nntpd | 2 +-
script/public-inbox-purge | 2 +-
script/public-inbox-watch | 2 +-
script/public-inbox-xcpdb | 3 ++-
script/public-inbox.cgi | 2 +-
scripts/dupe-finder | 2 +-
scripts/import_maildir | 2 +-
scripts/import_slrnspool | 2 +-
scripts/import_vger_from_mbox | 2 +-
scripts/slrnspool2maildir | 2 +-
scripts/ssoma-replay | 3 ++-
scripts/xhdr-num2mid | 2 +-
t/check-www-inbox.perl | 2 +-
t/git-http-backend.psgi | 2 +-
t/hl_mod.t | 2 +-
34 files changed, 41 insertions(+), 34 deletions(-)
diff --git a/Documentation/extman.perl b/Documentation/extman.perl
index a72caca..cba689f 100755
--- a/Documentation/extman.perl
+++ b/Documentation/extman.perl
@@ -1,8 +1,9 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# prints a manpage to stdout
use strict;
+use warnings;
my $xapmsg = 'See https://xapian.org/ for more information on Xapian';
my $usage = "$0 /path/to/manpage.SECTION.txt";
my $manpage = shift or die $usage;
diff --git a/Documentation/standards.perl b/Documentation/standards.perl
index f75c412..92edbc9 100755
--- a/Documentation/standards.perl
+++ b/Documentation/standards.perl
@@ -1,5 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
use strict;
+use warnings;
# Copyright 2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
diff --git a/Makefile.PL b/Makefile.PL
index 8daeb4f..eb6f23c 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,7 +1,8 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2013-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
+use warnings;
use ExtUtils::MakeMaker;
open my $m, '<', 'MANIFEST' or die "open(MANIFEST): $!\n";
chomp(my @manifest = (<$m>));
diff --git a/certs/create-certs.perl b/certs/create-certs.perl
index b287cec..607cac5 100755
--- a/certs/create-certs.perl
+++ b/certs/create-certs.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# License: GPL-1.0+ or Artistic-1.0-Perl
# from IO::Socket::SSL 2.063 / https://github.com/noxxi/p5-io-socket-ssl
use strict;
diff --git a/ci/deps.perl b/ci/deps.perl
index 62870c1..d797a31 100755
--- a/ci/deps.perl
+++ b/ci/deps.perl
@@ -1,10 +1,11 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Helper script for installing/uninstalling packages for CI use
# Intended for use on non-production chroots or VMs since it
# changes installed packages
use strict;
+use warnings;
my $usage = "$0 PKG_FMT PROFILE [PROFILE_MOD]";
my $pkg_fmt = shift;
@ARGV or die $usage, "\n";
diff --git a/examples/cgit.psgi b/examples/cgit.psgi
index ca93f92..8c8a904 100644
--- a/examples/cgit.psgi
+++ b/examples/cgit.psgi
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2019 all contributors <meta@public-inbox.org>
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
#
diff --git a/examples/highlight.psgi b/examples/highlight.psgi
index 244b128..b07181f 100644
--- a/examples/highlight.psgi
+++ b/examples/highlight.psgi
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/examples/newswww.psgi b/examples/newswww.psgi
index 0f66782..64c1ad6 100644
--- a/examples/newswww.psgi
+++ b/examples/newswww.psgi
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2019 all contributors <meta@public-inbox.org>
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
#
diff --git a/examples/public-inbox.psgi b/examples/public-inbox.psgi
index 53a5970..92f525e 100644
--- a/examples/public-inbox.psgi
+++ b/examples/public-inbox.psgi
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2014-2019 all contributors <meta@public-inbox.org>
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
# Note: this is part of our test suite, update t/plack.t if this changes
diff --git a/examples/unsubscribe.milter b/examples/unsubscribe.milter
index d6db766..a0f87e0 100644
--- a/examples/unsubscribe.milter
+++ b/examples/unsubscribe.milter
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
diff --git a/examples/unsubscribe.psgi b/examples/unsubscribe.psgi
index 7020af2..a8968ce 100644
--- a/examples/unsubscribe.psgi
+++ b/examples/unsubscribe.psgi
@@ -1,10 +1,11 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
# This should not require any other PublicInbox code, but may use
# PublicInbox::Config if ~/.public-inbox/config exists or
# PI_CONFIG is pointed to an appropriate location
use strict;
+use warnings;
use Plack::Builder;
use PublicInbox::Unsubscribe;
my $app = PublicInbox::Unsubscribe->new(
diff --git a/script/public-inbox-compact b/script/public-inbox-compact
index e8bf31e..ded81aa 100755
--- a/script/public-inbox-compact
+++ b/script/public-inbox-compact
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2018-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
diff --git a/script/public-inbox-convert b/script/public-inbox-convert
index 9d2d251..09e0be0 100755
--- a/script/public-inbox-convert
+++ b/script/public-inbox-convert
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2018-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <http://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
diff --git a/script/public-inbox-edit b/script/public-inbox-edit
index 6884fd0..e9c206e 100755
--- a/script/public-inbox-edit
+++ b/script/public-inbox-edit
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/script/public-inbox-httpd b/script/public-inbox-httpd
index b2464f4..da786de 100755
--- a/script/public-inbox-httpd
+++ b/script/public-inbox-httpd
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/script/public-inbox-index b/script/public-inbox-index
index 439da15..4da9dca 100755
--- a/script/public-inbox-index
+++ b/script/public-inbox-index
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2015-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Basic tool to create a Xapian search index for a git repository
diff --git a/script/public-inbox-init b/script/public-inbox-init
index 98aea4b..5ec74e9 100755
--- a/script/public-inbox-init
+++ b/script/public-inbox-init
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2014-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/script/public-inbox-learn b/script/public-inbox-learn
index c4c4d4b..6362a83 100755
--- a/script/public-inbox-learn
+++ b/script/public-inbox-learn
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2014-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/script/public-inbox-mda b/script/public-inbox-mda
index 4e6e04e..81f7d0c 100755
--- a/script/public-inbox-mda
+++ b/script/public-inbox-mda
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2013-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/script/public-inbox-nntpd b/script/public-inbox-nntpd
index 3c4be19..2476780 100755
--- a/script/public-inbox-nntpd
+++ b/script/public-inbox-nntpd
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2015-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/script/public-inbox-purge b/script/public-inbox-purge
index 0705d17..e5cd602 100755
--- a/script/public-inbox-purge
+++ b/script/public-inbox-purge
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/script/public-inbox-watch b/script/public-inbox-watch
index 5cbf761..fc220a1 100755
--- a/script/public-inbox-watch
+++ b/script/public-inbox-watch
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
diff --git a/script/public-inbox-xcpdb b/script/public-inbox-xcpdb
index b41c683..a043b7c 100755
--- a/script/public-inbox-xcpdb
+++ b/script/public-inbox-xcpdb
@@ -1,7 +1,8 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# xcpdb: Xapian copy database, a wrapper around Xapian's copydatabase(1)
+use warnings;
use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
use PublicInbox::InboxWritable;
use PublicInbox::Xapcmd;
diff --git a/script/public-inbox.cgi b/script/public-inbox.cgi
index c0e8e6c..0bf9a1a 100755
--- a/script/public-inbox.cgi
+++ b/script/public-inbox.cgi
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2014-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ or later <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/scripts/dupe-finder b/scripts/dupe-finder
index 1e98093..afb3610 100644
--- a/scripts/dupe-finder
+++ b/scripts/dupe-finder
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2018-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/scripts/import_maildir b/scripts/import_maildir
index fbf3f64..bd6b1de 100755
--- a/scripts/import_maildir
+++ b/scripts/import_maildir
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2014, Eric Wong <e@80x24.org> and all contributors
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/scripts/import_slrnspool b/scripts/import_slrnspool
index 1dccb8d..7e85d26 100755
--- a/scripts/import_slrnspool
+++ b/scripts/import_slrnspool
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2015-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/scripts/import_vger_from_mbox b/scripts/import_vger_from_mbox
index b2dd5b3..413936a 100644
--- a/scripts/import_vger_from_mbox
+++ b/scripts/import_vger_from_mbox
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
diff --git a/scripts/slrnspool2maildir b/scripts/slrnspool2maildir
index b321db1..f5599c1 100755
--- a/scripts/slrnspool2maildir
+++ b/scripts/slrnspool2maildir
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2013-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
diff --git a/scripts/ssoma-replay b/scripts/ssoma-replay
index f20e027..c59215c 100755
--- a/scripts/ssoma-replay
+++ b/scripts/ssoma-replay
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2015-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
@@ -26,6 +26,7 @@ ssoma add $NAME $URL "command:/path/to/ssoma-replay -L /path/to/spool/$NAME"
command = /path/to/ssoma-replay -L /path/to/spool/meta
=cut
use strict;
+use warnings;
use Email::Simple;
use URI::Escape qw/uri_escape_utf8/;
use File::Temp qw/tempfile/;
diff --git a/scripts/xhdr-num2mid b/scripts/xhdr-num2mid
index 717fa46..79a94a4 100755
--- a/scripts/xhdr-num2mid
+++ b/scripts/xhdr-num2mid
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Useful for mapping article IDs from existing NNTP servers to MIDs
diff --git a/t/check-www-inbox.perl b/t/check-www-inbox.perl
index db292c5..77569d9 100644
--- a/t/check-www-inbox.perl
+++ b/t/check-www-inbox.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Parallel WWW checker
diff --git a/t/git-http-backend.psgi b/t/git-http-backend.psgi
index ed70d50..dc4967d 100644
--- a/t/git-http-backend.psgi
+++ b/t/git-http-backend.psgi
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
diff --git a/t/hl_mod.t b/t/hl_mod.t
index fc7b712..827b232 100644
--- a/t/hl_mod.t
+++ b/t/hl_mod.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
--
2.22.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] #!/usr/bin/perl -> #!/usr/bin/env perl
2019-09-24 20:43 [PATCH] #!/usr/bin/perl -> #!/usr/bin/env perl Alyssa Ross
@ 2019-09-26 2:49 ` Eric Wong
2019-10-01 17:47 ` Alyssa Ross
0 siblings, 1 reply; 6+ messages in thread
From: Eric Wong @ 2019-09-26 2:49 UTC (permalink / raw)
To: Alyssa Ross; +Cc: meta
Alyssa Ross <hi@alyssa.is> wrote:
> It's much more reasonable to assume that the Perl a user wants to use
> is the one they have in their path, rather than whatever one has been
> installed system-wide by their distribution (if any!).
I used to think that, too...
Nowadays, I would only use "/usr/bin/env perl" for standalone
or standard-library-only scripts; but nothing with
non-standard-library dependencies.
Some general notes:
* Perl will parse the "-w" in a shebang even if it's invoked as
"perl /path/to/script" without the "-w"
* "-w" is stronger than "use warnings", in that it applies to
the whole program rather than the scope of "use warnings"
* Different Perl installations can have different modules
installed for it, so relying on /usr/bin/env can lead
to surprises + failures when libraries are missing.
* "/usr/bin/env perl" won't take into account "perl5.xx" names
that dev versions of Perl get installed as by default, so shebang
rewriting is necessary for anything end users would use, anyways.
* I've been looking into startup time of some scripts, and
"use warnings" adds more open() syscalls which affects
performance a miniscule amount (maybe more for Intel CPUs with
vulnerabilities). So I might get rid of some "use warnings"
in those paths rely on "-w" down the line...
Reordering the diffstat slightly...
> Makefile.PL | 3 ++-
Makefile.PL doesn't have the executable bit set, and all the
documentation says to run it as "perl Makefile.PL"
The reason for the shebang is for external tools,
highlighters and stuff like file(1).
> Documentation/extman.perl | 3 ++-
> Documentation/standards.perl | 3 ++-
Makefile.PL writes a Makefile which sets $(PERL), with an
absolute path to run those files.
> certs/create-certs.perl | 2 +-
Documentation in corresponding t/*.t files could be better
about running that and instead recommend "$^X"
> ci/deps.perl | 3 ++-
That's only run via $PERL (which defaults to 'perl')
> examples/cgit.psgi | 2 +-
> examples/highlight.psgi | 2 +-
> examples/newswww.psgi | 2 +-
> examples/public-inbox.psgi | 2 +-
> examples/unsubscribe.psgi | 3 ++-
> t/git-http-backend.psgi | 2 +-
I only had the shebang there for external tools.
Running a .psgi directly via Perl wouldn't work.
"#!/usr/bin/plackup" might work if it was executable,
but I'm not sure if people do that w/o command-line
options.
> examples/unsubscribe.milter | 2 +-
That could probably be installed via Makefile using
$(FIXIN) like the rest of the stuff in script/ below
(but not by default).
> script/public-inbox-compact | 2 +-
> script/public-inbox-convert | 2 +-
> script/public-inbox-edit | 2 +-
> script/public-inbox-httpd | 2 +-
> script/public-inbox-index | 2 +-
> script/public-inbox-init | 2 +-
> script/public-inbox-learn | 2 +-
> script/public-inbox-mda | 2 +-
> script/public-inbox-nntpd | 2 +-
> script/public-inbox-purge | 2 +-
> script/public-inbox-watch | 2 +-
> script/public-inbox-xcpdb | 3 ++-
> script/public-inbox.cgi | 2 +-
All of these are handled by $(FIXIN) in the Makefile.
I install these on FreeBSD which puts Perl in /usr/local/bin
and never had a problem.
> scripts/dupe-finder | 2 +-
> scripts/import_maildir | 2 +-
> scripts/import_slrnspool | 2 +-
> scripts/import_vger_from_mbox | 2 +-
> scripts/slrnspool2maildir | 2 +-
> scripts/ssoma-replay | 3 ++-
> scripts/xhdr-num2mid | 2 +-
> t/check-www-inbox.perl | 2 +-
None of these are really serious scripts, and if they're run;
it's always via "perl /path/to/script"
> t/hl_mod.t | 2 +-
Oops, there probably shouldn't have a shebang there at all
since none of the other *.t files have it. I've also seen
"#!perl -w" (no '/' at all) in other projects, but I don't think
it's worth the effort unless some external tools/highlighters
work better with it. I expect "#!/usr/bin/perl -w" to be most
compatible with highlighters and stuff like file(1).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] #!/usr/bin/perl -> #!/usr/bin/env perl
2019-09-26 2:49 ` Eric Wong
@ 2019-10-01 17:47 ` Alyssa Ross
2019-10-01 20:58 ` Eric Wong
0 siblings, 1 reply; 6+ messages in thread
From: Alyssa Ross @ 2019-10-01 17:47 UTC (permalink / raw)
To: Eric Wong; +Cc: meta
[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]
>> certs/create-certs.perl | 2 +-
>
> Documentation in corresponding t/*.t files could be better
> about running that and instead recommend "$^X"
Makes sense. This was the one that was giving me problems in the first
place.
>> t/hl_mod.t | 2 +-
>
> Oops, there probably shouldn't have a shebang there at all
> since none of the other *.t files have it. I've also seen
> "#!perl -w" (no '/' at all) in other projects, but I don't think
> it's worth the effort unless some external tools/highlighters
> work better with it. I expect "#!/usr/bin/perl -w" to be most
> compatible with highlighters and stuff like file(1).
#!perl has some nice characteristics -- it's understood by the
interpreter for setting flags, and for -x, but at the same time it's
clear that a file with #!perl is not supposed to be directly executed.
Assuming you don't want to change to #!perl, do you want a patch to
recommend running certs/create-certs.perl and remove the shebang from
t/hl_mod.t? And should the executable bits still be set on the other
files?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] #!/usr/bin/perl -> #!/usr/bin/env perl
2019-10-01 17:47 ` Alyssa Ross
@ 2019-10-01 20:58 ` Eric Wong
2019-10-02 21:36 ` [PATCH] tests: recommend running create-certs.pl with $^X Alyssa Ross
0 siblings, 1 reply; 6+ messages in thread
From: Eric Wong @ 2019-10-01 20:58 UTC (permalink / raw)
To: Alyssa Ross; +Cc: meta
Alyssa Ross <hi@alyssa.is> wrote:
> >> certs/create-certs.perl | 2 +-
> >
> > Documentation in corresponding t/*.t files could be better
> > about running that and instead recommend "$^X"
>
> Makes sense. This was the one that was giving me problems in the first
> place.
>
> >> t/hl_mod.t | 2 +-
> >
> > Oops, there probably shouldn't have a shebang there at all
> > since none of the other *.t files have it. I've also seen
> > "#!perl -w" (no '/' at all) in other projects, but I don't think
> > it's worth the effort unless some external tools/highlighters
> > work better with it. I expect "#!/usr/bin/perl -w" to be most
> > compatible with highlighters and stuff like file(1).
>
> #!perl has some nice characteristics -- it's understood by the
> interpreter for setting flags, and for -x, but at the same time it's
> clear that a file with #!perl is not supposed to be directly executed.
Agreed. However, I'm not sure if compatibility with
highlighters would be as good as a full path.
> Assuming you don't want to change to #!perl, do you want a patch to
> recommend running certs/create-certs.perl and remove the shebang from
> t/hl_mod.t? And should the executable bits still be set on the other
> files?
Just the messages in t/*.t for certs/create-certs.perl is fine.
Thanks.
I don't think the other changes would affect users/testers.
Also, t/hl_mod.t as-is could be a good comparison for syntax
highlighters in the future (and I am leaning towards dropping
"use warnings").
Not sure if there's executable bits worth changing, now; I think
it's a good way to inform users that a given file can be
executed (rather than loaded via `require'); but the '.t' files
might be a special case...
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] tests: recommend running create-certs.pl with $^X
2019-10-01 20:58 ` Eric Wong
@ 2019-10-02 21:36 ` Alyssa Ross
2019-10-02 23:19 ` Eric Wong
0 siblings, 1 reply; 6+ messages in thread
From: Alyssa Ross @ 2019-10-02 21:36 UTC (permalink / raw)
To: Eric Wong; +Cc: meta, Alyssa Ross
This is better than recommending running the script directly because
it will ensure the correct version of perl is used.
---
t/httpd-https.t | 2 +-
t/nntpd-tls.t | 2 +-
t/nntpd-validate.t | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/httpd-https.t b/t/httpd-https.t
index 410ae65..22c62bf 100644
--- a/t/httpd-https.t
+++ b/t/httpd-https.t
@@ -14,7 +14,7 @@ my $cert = 'certs/server-cert.pem';
my $key = 'certs/server-key.pem';
unless (-r $key && -r $cert) {
plan skip_all =>
- "certs/ missing for $0, run ./create-certs.perl in certs/";
+ "certs/ missing for $0, run $^X ./create-certs.perl in certs/";
}
use_ok 'PublicInbox::TLS';
use_ok 'IO::Socket::SSL';
diff --git a/t/nntpd-tls.t b/t/nntpd-tls.t
index e961965..1a74924 100644
--- a/t/nntpd-tls.t
+++ b/t/nntpd-tls.t
@@ -20,7 +20,7 @@ my $cert = 'certs/server-cert.pem';
my $key = 'certs/server-key.pem';
unless (-r $key && -r $cert) {
plan skip_all =>
- "certs/ missing for $0, run ./create-certs.perl in certs/";
+ "certs/ missing for $0, run $^X ./create-certs.perl in certs/";
}
use_ok 'PublicInbox::TLS';
diff --git a/t/nntpd-validate.t b/t/nntpd-validate.t
index 532ef72..87829b0 100644
--- a/t/nntpd-validate.t
+++ b/t/nntpd-validate.t
@@ -32,7 +32,7 @@ my $test_tls = $ENV{TEST_SKIP_TLS} ? 0 : eval { require IO::Socket::SSL };
my $cert = 'certs/server-cert.pem';
my $key = 'certs/server-key.pem';
if ($test_tls && !-r $key || !-r $cert) {
- plan skip_all => "certs/ missing for $0, run ./certs/create-certs.perl";
+ plan skip_all => "certs/ missing for $0, run $^X ./certs/create-certs.perl";
}
require './t/common.perl';
my $keep_tmp = !!$ENV{TEST_KEEP_TMP};
--
2.23.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] tests: recommend running create-certs.pl with $^X
2019-10-02 21:36 ` [PATCH] tests: recommend running create-certs.pl with $^X Alyssa Ross
@ 2019-10-02 23:19 ` Eric Wong
0 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2019-10-02 23:19 UTC (permalink / raw)
To: Alyssa Ross; +Cc: meta
Alyssa Ross <hi@alyssa.is> wrote:
> This is better than recommending running the script directly because
> it will ensure the correct version of perl is used.
Applied and pushed, thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-10-02 23:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-24 20:43 [PATCH] #!/usr/bin/perl -> #!/usr/bin/env perl Alyssa Ross
2019-09-26 2:49 ` Eric Wong
2019-10-01 17:47 ` Alyssa Ross
2019-10-01 20:58 ` Eric Wong
2019-10-02 21:36 ` [PATCH] tests: recommend running create-certs.pl with $^X Alyssa Ross
2019-10-02 23:19 ` Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).