coreutils
[Top][All Lists]
Advanced

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

[PATCH 4/7] tests: avoid use of '-T' in shebang line to enable perl tain


From: Stefano Lattarini
Subject: [PATCH 4/7] tests: avoid use of '-T' in shebang line to enable perl taint mode
Date: Thu, 30 Aug 2012 14:13:10 +0200

* tests/rm/fail-eperm: Rename ...
* tests/rm/fail-eperm.xpl: ... like this
* tests/Makefile.am (TESTS): Adjust.
(TEST_EXTENSIONS): New, list '.xpl'.
(XPL_TEST_LOGS): New, run a perl test in tainted mode.
* tests/shell-or-perl: Simplify this script: we no longer need to
parse the shebang line and adjust the flags in the perl invocation
accordingly.
---
 tests/Makefile.am                       | 8 +++++++-
 tests/rm/{fail-eperm => fail-eperm.xpl} | 0
 tests/shell-or-perl                     | 9 ++-------
 3 files changed, 9 insertions(+), 8 deletions(-)
 rename tests/rm/{fail-eperm => fail-eperm.xpl} (100%)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9839030..581f803 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -45,6 +45,8 @@ check_DATA = .built-programs
             && MAKEFLAGS= $(MAKE) -s built_programs.list)              \
           > $@-t && mv $@-t $@
 
+TEST_EXTENSIONS = .xpl
+
 # '$f' is set by the Automake-generated test harness to the path of the
 # current test script stripped of VPATH components, and is used by the
 # shell-or-perl script to determine the name of the temporary files to be
@@ -55,6 +57,10 @@ LOG_COMPILER = \
   --test-name "$$f" --srcdir '$(srcdir)' \
   --shell '$(SHELL)' --perl '$(PERL)' --
 
+# Perl scripts that must be run in tainted mode.
+XPL_LOG_COMPILER = \
+  $(PERL) -wT -I$(srcdir) -MCoreutils -MCuSkip -M"CuTmpdir qw($$f)"
+
 # Note that the first lines are statements.  They ensure that environment
 # variables that can perturb tests are unset or set to expected values.
 # The rest are envvar settings that propagate build-related Makefile
@@ -207,7 +213,7 @@ TESTS =                                             \
   rm/empty-name                                        \
   rm/f-1                                       \
   rm/fail-eacces                               \
-  rm/fail-eperm                                        \
+  rm/fail-eperm.xpl                            \
   tail-2/assert                                        \
   rm/hash                                      \
   rm/i-1                                       \
diff --git a/tests/rm/fail-eperm b/tests/rm/fail-eperm.xpl
similarity index 100%
rename from tests/rm/fail-eperm
rename to tests/rm/fail-eperm.xpl
diff --git a/tests/shell-or-perl b/tests/shell-or-perl
index 58c80e3..cb80edf 100644
--- a/tests/shell-or-perl
+++ b/tests/shell-or-perl
@@ -1,7 +1,6 @@
 #! /bin/sh
 # Run a test script of the coreutils test scripts, picking up the right
-# interpreter (i.e., perl or the shell) and the right flags for it (e.g.,
-# perl '-T' flag for perl scripts that must run in tainted mode).
+# interpreter (i.e., perl or the shell) and the right flags for it.
 #
 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
 #
@@ -96,11 +95,7 @@ case $shebang_line in
 '#!/usr/bin/perl'*)
   # The test is a perl script.
   if $cu_PERL -e 'use warnings' > /dev/null 2>&1; then
-    # Perl is available, see if we must run the test with taint
-    # mode on or not.
-    case $shebang_line in *\ -T*) T_=T;; *) T_=;; esac
-    # Now run it.
-    exec $cu_PERL -w$T_ -I"$srcdir" -MCoreutils -MCuSkip \
+    exec $cu_PERL -w -I"$srcdir" -MCoreutils -MCuSkip \
                   -M"CuTmpdir qw($test_name)" \
                   -- "$test_script" ${1+"$@"}
   else
-- 
1.7.12




reply via email to

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