bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Explicit interpreter paths considered harmful


From: Eric Blake
Subject: Re: Explicit interpreter paths considered harmful
Date: Mon, 2 Nov 2009 17:28:33 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Jim Meyering <jim <at> meyering.net> writes:

> Rather than putting #!/usr/bin/perl on the first line,
> start with a variant of what's recommended by "man perlrun" that
> invokes the first "perl" program from your shell's search path.

We should change the test to match.  I also ran into a failure on cygwin, where 
apparently the new style creates .bak files (even though we are requesting -i 
without a suffix):

| FAIL: test-update-copyright.sh (exit: 1)
| ========================================
| 
| --- -   2009-11-02 09:04:12.699584300 -0700
| +++ update-copyright.test-ex-stderr     2009-11-02 09:04:12.652715900 -0700
| @@ -1,2 +1,4 @@
|  update-copyright.test-ex.4: warning: FSF copyright statement not found
| +update-copyright.test-ex.4.bak: warning: FSF copyright statement not found
|  update-copyright.test-ex.5: warning: FSF copyright statement not found
| +update-copyright.test-ex.5.bak: warning: FSF copyright statement not found

So here's what I'm thinking of pushing:

>From 4148ce0ef79cd2eb741d2a22c1aa011d10129b2c Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 2 Nov 2009 10:23:33 -0700
Subject: [PATCH] test-update-copyright: update test to match script changes

* tests/test-update-copyright.sh: Avoid hard-coding perl
location.  Don't update *.bak created by earlier runs.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog                      |    6 ++++++
 tests/test-update-copyright.sh |   10 +++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9014fcc..bcb47c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-02  Eric Blake  <address@hidden>
+
+       test-update-copyright: update test to match script changes
+       * tests/test-update-copyright.sh: Avoid hard-coding perl
+       location.  Don't update *.bak created by earlier runs.
+
 2009-10-30  Eric Blake  <address@hidden>

        vasnprintf: avoid compiler warnings
diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh
index 24574b2..859c75d 100755
--- a/tests/test-update-copyright.sh
+++ b/tests/test-update-copyright.sh
@@ -32,7 +32,12 @@ trap 'rm -f $TMP_BASE*' 0 1 2 3 15

 TMP=$TMP_BASE
 s=$TMP-script
-printf '#!/usr/bin/perl -pi\ns/a/b/\n' > $s
+cat <<\EOF > $s
+eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}'
+  & eval 'exec perl -wS -0777 -pi "$0" $argv:q'
+    if 0;
+s/a/b/
+EOF
 chmod a+x $s
 echo a > $TMP-in
 ./$s $TMP-in 2>/dev/null && test b = "`cat $TMP-in 2>/dev/null`" ||
@@ -82,6 +87,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Foundation, Inc.
 EOF

+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2009 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
@@ -124,6 +130,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Foundation, Inc.
 EOF

+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
@@ -162,6 +169,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
 EOF

+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_FORCE=1 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
-- 
1.6.4.2







reply via email to

[Prev in Thread] Current Thread [Next in Thread]