]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix Autotest tracing of shell pipelines for FreeBSD sh.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 2 Mar 2010 06:48:42 +0000 (07:48 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 2 Mar 2010 06:48:42 +0000 (07:48 +0100)
* lib/autotest/general.m4 (_AT_DECIDE_TRACEABLE): Do not trace
commands that contain [^|]|[^|], a likely shell pipeline.
* tests/local.at (_AT_CHECK_ENV): Turn off tracing for egrep |
grep pipeline.
* doc/autoconf.texi (File Descriptors): Document limitation.
* tests/autotest.at (Trace output): New test.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
doc/autoconf.texi
lib/autotest/general.m4
tests/autotest.at
tests/local.at

index 523628e8f28f2ec07ec9a97755854aabbfe5ae97..3be2d1cc27e94a637e39c1b6e122f38b482b99e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-03-02  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix Autotest tracing of shell pipelines for FreeBSD sh.
+       * lib/autotest/general.m4 (_AT_DECIDE_TRACEABLE): Do not trace
+       commands that contain [^|]|[^|], a likely shell pipeline.
+       * tests/local.at (_AT_CHECK_ENV): Turn off tracing for egrep |
+       grep pipeline.
+       * doc/autoconf.texi (File Descriptors): Document limitation.
+       * tests/autotest.at (Trace output): New test.
+
 2010-03-01  Eric Blake  <eblake@redhat.com>
 
        Update file flow diagram to mention Automake.
index 191a3979b950dddfc44fb01909ec4fc94b6cb422..04c8e91fb3d78e080be9514def78a59c65045ab6 100644 (file)
@@ -14785,6 +14785,9 @@ must be done @emph{inside} the command substitution.  When running
 @samp{: `cd /zorglub` 2>/dev/null} expect the error message to
 escape, while @samp{: `cd /zorglub 2>/dev/null`} works properly.
 
+FreeBSD 6.2 sh may mix the trace output lines from the statements in a
+shell pipeline.
+
 It is worth noting that Zsh (but not Ash nor Bash) makes it possible
 in assignments though: @samp{foo=`cd /zorglub` 2>/dev/null}.
 
index 71e3090a5bcc6a84e5cce6011c39d5d4a41d48f8..79421645ba45dc6b9a3b375064b1f4a010ab026b 100644 (file)
@@ -2034,6 +2034,8 @@ m4_cond([m4_eval(m4_index([$1], [`]) >= 0)], [1],
                [[a ${...} parameter expansion]],
        [m4_eval(m4_index([$1], m4_newline) >= 0)], [1],
                [[an embedded newline]],
+       [m4_eval(m4_bregexp([$1], [[^|]|[^|]]) >= 0)], [1],
+               [[a shell pipeline]],
        []))]dnl No reason.
 [m4_if(m4_index(_m4_defn([at_reason]), [a]), [0],]dnl
 dnl We know at build time that tracing COMMANDS is never safe.
index 8a088970ec00a5ed0cde5413eef8313ad904c5bf..88078aceabdb6549ecceb81136055b7ef890a4c9 100644 (file)
@@ -349,6 +349,12 @@ AT_CHECK_AT_TEST([unquoted output],
      [${a}"`echo 'b  '`\`\backtick]m4_newline)],
   [], [], [], [], [AT_KEYWORDS([AT@&t@_CHECK_UNQUOTED])])
 
+AT_CHECK_AT_TEST([Trace output],
+  [AT_CHECK([echo some longer longer longer command piped | ]dnl
+           [sed 's,into some other longer longer longer command,,'],
+           [], [some longer longer longer command piped
+])])
+
 AT_CHECK_AT([Logging],
   [[AT_INIT([artificial test suite])
     dnl intentionally write failing tests, to see what gets logged
index dcfdf6088c214c0ba877f262ab1f8fbca541335f..c26d071331a61e5da80af11a173f4456469f6706 100644 (file)
@@ -243,6 +243,9 @@ m4_define([AT_CHECK_CONFIGURE],
 # In this case just don't pay attention to the env.  It would be great
 # to keep the error message but we can't: that would break AT_CHECK.
 #
+# FreeBSD sh may intermingle the trace output from the egrep and grep
+# commands in the pipe, so turn off tracing for these.
+#
 # Some tests might exit prematurely when they find a problem, in
 # which case `env-after' is probably missing.  Don't check it then.
 #
@@ -287,6 +290,7 @@ test -f state-ls.after \
   && { $at_diff state-ls.before state-ls.after || return 1; }
 # Compare variable space dumps.
 if test -f state-env.before && test -f state-env.after; then
+  set +x
   for act_file in state-env.before state-env.after
   do
     $EGREP -v '^(m4_join([|],
@@ -316,6 +320,7 @@ if test -f state-env.before && test -f state-env.after; then
       # There may be variables spread on several lines; remove latter lines.
       $GREP '^m4_defn([m4_re_word])=' >clean-$act_file
   done
+  $at_traceon
   $at_diff clean-state-env.before clean-state-env.after
 fi
 } [#]at_check_env])