Thanks for looking into and fixing that. One quibble: those long comments are probably more trouble than they're worth. I found that they got in the way of my understanding the code, as my eyes glazed over when reading them. And when I finally forced myself to read one, I found that at least one important detail was missing: the "#! -*-perl-*-" line is not just there for Emacs, but is also there for Perl.

Instead of adding even more length to a comment that is already a bit of an obstacle to understanding the code, I suggest we just cite perlrun's man page as in the attached proposed patch. This should be good enough for anyone who's not already versed in perl+sh.
>From 7969fe73da89ac372c681dca7839b880b59767f1 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Sat, 15 Jun 2019 11:27:52 -0700
Subject: [PATCH] Use shorter perlrun comment

* build-aux/announce-gen, build-aux/gitlog-to-changelog:
* build-aux/prefix-gnulib-mk, build-aux/update-copyright:
* build-aux/useless-if-before-free, tests/test-update-copyright.sh:
Just cite perlrun(1) in the comment.
---
 ChangeLog                        |  8 ++++++++
 build-aux/announce-gen           | 13 +------------
 build-aux/gitlog-to-changelog    | 13 +------------
 build-aux/prefix-gnulib-mk       | 13 +------------
 build-aux/update-copyright       | 13 +------------
 build-aux/useless-if-before-free | 13 +------------
 tests/test-update-copyright.sh   | 13 +------------
 7 files changed, 14 insertions(+), 72 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a0d2f415f..77e66c0e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-06-15  Paul Eggert  <egg...@cs.ucla.edu>
+
+	Use shorter perlrun comment
+	* build-aux/announce-gen, build-aux/gitlog-to-changelog:
+	* build-aux/prefix-gnulib-mk, build-aux/update-copyright:
+	* build-aux/useless-if-before-free, tests/test-update-copyright.sh:
+	Just cite perlrun(1) in the comment.
+
 2019-06-15  Bruno Haible  <br...@clisp.org>
 
 	Fix scripts to have valid executable format on Alpine Linux.
diff --git a/build-aux/announce-gen b/build-aux/announce-gen
index b5728338c..1e2648d0e 100755
--- a/build-aux/announce-gen
+++ b/build-aux/announce-gen
@@ -1,17 +1,6 @@
 #!/bin/sh
 #! -*-perl-*-
-# This is a prologue that allows to run a perl script as an executable
-# on systems that are compliant to a POSIX version before POSIX:2017.
-# On such systems, the usual invocation of an executable through execlp()
-# or execvp() fails with ENOEXEC if it is a script that does not start
-# with a #! line.  The script interpreter mentioned in the #! line has
-# to be /bin/sh, because on GuixSD systems that is the only program that
-# has a fixed file name.  The second line is for editing this file in
-# Emacs.  The next two lines below are valid code in both sh and perl.
-# When executed by sh, they re-execute the script through the perl
-# program found in $PATH.  The '-x' option is essential; without it,
-# perl would re-execute the script through /bin/sh.  When executed by
-# perl, the next two lines are a no-op.
+# Either perl or sh can run this file; see perlrun(1).
 eval 'exec perl -wSx "$0" "$@"'
      if 0;
 
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index a616b8234..68722bacb 100755
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -1,17 +1,6 @@
 #!/bin/sh
 #! -*-perl-*-
-# This is a prologue that allows to run a perl script as an executable
-# on systems that are compliant to a POSIX version before POSIX:2017.
-# On such systems, the usual invocation of an executable through execlp()
-# or execvp() fails with ENOEXEC if it is a script that does not start
-# with a #! line.  The script interpreter mentioned in the #! line has
-# to be /bin/sh, because on GuixSD systems that is the only program that
-# has a fixed file name.  The second line is for editing this file in
-# Emacs.  The next two lines below are valid code in both sh and perl.
-# When executed by sh, they re-execute the script through the perl
-# program found in $PATH.  The '-x' option is essential; without it,
-# perl would re-execute the script through /bin/sh.  When executed by
-# perl, the next two lines are a no-op.
+# Either perl or sh can run this file; see perlrun(1).
 eval 'exec perl -wSx "$0" "$@"'
      if 0;
 
diff --git a/build-aux/prefix-gnulib-mk b/build-aux/prefix-gnulib-mk
index 66e138b46..10871a286 100755
--- a/build-aux/prefix-gnulib-mk
+++ b/build-aux/prefix-gnulib-mk
@@ -1,17 +1,6 @@
 #!/bin/sh
 #! -*-perl-*-
-# This is a prologue that allows to run a perl script as an executable
-# on systems that are compliant to a POSIX version before POSIX:2017.
-# On such systems, the usual invocation of an executable through execlp()
-# or execvp() fails with ENOEXEC if it is a script that does not start
-# with a #! line.  The script interpreter mentioned in the #! line has
-# to be /bin/sh, because on GuixSD systems that is the only program that
-# has a fixed file name.  The second line is for editing this file in
-# Emacs.  The next two lines below are valid code in both sh and perl.
-# When executed by sh, they re-execute the script through the perl
-# program found in $PATH.  The '-x' option is essential; without it,
-# perl would re-execute the script through /bin/sh.  When executed by
-# perl, the next two lines are a no-op.
+# Either perl or sh can run this file; see perlrun(1).
 eval 'exec perl -wSx "$0" "$@"'
      if 0;
 
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index fa9d427e9..445c9cb06 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,17 +1,6 @@
 #!/bin/sh
 #! -*-perl-*-
-# This is a prologue that allows to run a perl script as an executable
-# on systems that are compliant to a POSIX version before POSIX:2017.
-# On such systems, the usual invocation of an executable through execlp()
-# or execvp() fails with ENOEXEC if it is a script that does not start
-# with a #! line.  The script interpreter mentioned in the #! line has
-# to be /bin/sh, because on GuixSD systems that is the only program that
-# has a fixed file name.  The second line is for editing this file in
-# Emacs.  The next two lines below are valid code in both sh and perl.
-# When executed by sh, they re-execute the script through the perl
-# program found in $PATH.  The '-x' option is essential; without it,
-# perl would re-execute the script through /bin/sh.  When executed by
-# perl, the next two lines are a no-op.
+# Either perl or sh can run this file; see perlrun(1).
 eval 'exec perl -wSx "$0" "$@"'
      if 0;
 
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index 0701e7b20..36ff86409 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -1,17 +1,6 @@
 #!/bin/sh
 #! -*-perl-*-
-# This is a prologue that allows to run a perl script as an executable
-# on systems that are compliant to a POSIX version before POSIX:2017.
-# On such systems, the usual invocation of an executable through execlp()
-# or execvp() fails with ENOEXEC if it is a script that does not start
-# with a #! line.  The script interpreter mentioned in the #! line has
-# to be /bin/sh, because on GuixSD systems that is the only program that
-# has a fixed file name.  The second line is for editing this file in
-# Emacs.  The next two lines below are valid code in both sh and perl.
-# When executed by sh, they re-execute the script through the perl
-# program found in $PATH.  The '-x' option is essential; without it,
-# perl would re-execute the script through /bin/sh.  When executed by
-# perl, the next two lines are a no-op.
+# Either perl or sh can run this file; see perlrun(1).
 eval 'exec perl -wSx "$0" "$@"'
      if 0;
 
diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh
index 9ef5344ea..30e7090b7 100755
--- a/tests/test-update-copyright.sh
+++ b/tests/test-update-copyright.sh
@@ -39,18 +39,7 @@ s=$TMP-script
 cat <<\EOF > $s
 #!/bin/sh
 #! -*-perl-*-
-# This is a prologue that allows to run a perl script as an executable
-# on systems that are compliant to a POSIX version before POSIX:2017.
-# On such systems, the usual invocation of an executable through execlp()
-# or execvp() fails with ENOEXEC if it is a script that does not start
-# with a #! line.  The script interpreter mentioned in the #! line has
-# to be /bin/sh, because on GuixSD systems that is the only program that
-# has a fixed file name.  The second line is for editing this file in
-# Emacs.  The next two lines below are valid code in both sh and perl.
-# When executed by sh, they re-execute the script through the perl
-# program found in $PATH.  The '-x' option is essential; without it,
-# perl would re-execute the script through /bin/sh.  When executed by
-# perl, the next two lines are a no-op.
+# Either perl or sh can run this file; see perlrun(1).
 eval 'exec perl -wSx "$0" "$@"'
      if 0;
 
-- 
2.21.0

Reply via email to