+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.
@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}.
[[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.
[${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
# 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.
#
&& { $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([|],
# 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])