Re: [PATCH v2 1/2] t1510: remove need for "test_untraceable", retain coverage
On Thu, Dec 02, 2021 at 08:16:35PM +0100, SZEDER Gábor wrote:
Show 14 quoted lines
> > @@ -62,7 +59,7 @@ test_repo () {
> > export GIT_WORK_TREE
> > fi &&
> > rm -f trace &&
> > - GIT_TRACE_SETUP="$(pwd)/trace" git symbolic-ref HEAD >/dev/null &&
> > + GIT_TRACE_SETUP="$(pwd)/trace" git symbolic-ref HEAD >/dev/null 2>>stderr &&
>
> I suspect that it's lines like this that make Peff argue for
> BASH_XTRACEFD :)
>
> While this is not a compound command, it does contain a command
> substitution, and the trace generated when executing the command in
> that command substitution goes to the command's stderr, and then,
> because of the redirection, to the 'stderr' file.Better still, the behavior varies between shells:
$ bash -c 'set -x; FOO=$(echo foo) echo main >stdout 2>stderr; set +x; grep . stdout stderr'
++ echo foo
+ FOO=foo
+ echo main
+ set +x
stdout:main
$ dash -c 'set -x; FOO=$(echo foo) echo main >stdout 2>stderr; set +x; grep . stdout stderr'
+ FOO=foo echo main
+ set +x
stdout:main
stderr:+ echo foo
-Peff