From: Junio C Hamano Date: Tue, 10 May 2016 21:13:26 GMT Subject: Re: [PATCH 2/2] t3404: be resilient against running with the -x flag Message-ID: In-Reply-To: <20160510205800.GC19958@sigill.intra.peff.net> Jeff King writes: > On Tue, May 10, 2016 at 12:49:42PM -0700, Junio C Hamano wrote: > >> I wonder if we can fix "-x" instead so that we do not have to >> butcher tests like this patch does. It was quite clear what it >> expected to see before this patch, and it is sad that the workaround >> makes less readable (and relies on the real output we are looking >> for never begins with '+'). > > I don't think there is a scalable, portable way to do so. "-x" output is > going to stderr, and is inherited by any functions or subshells. So > either we have to ask "-x" output to go somewhere else, or we have to > turn it off inside the functions and subshells. The latter requires > tweaking each site, which isn't scalable. And there is no way to do the > former in a portable way (AFAIK). Yeah, that was the conclusion I was coming to; the same "unscalable" argument applies to the patch under discussion, too. > That being said, bash supports BASH_XTRACEFD, so maybe something like > this: > > diff --git a/t/test-lib.sh b/t/test-lib.sh > index 286c5f3..482ec11 100644 > --- a/t/test-lib.sh > +++ b/t/test-lib.sh > @@ -321,6 +321,7 @@ then > else > exec 4>/dev/null 3>/dev/null > fi > +BASH_XTRACEFD=4 > > test_failure=0 > test_count=0 > > would help Dscho's case (and people on other shells aren't helped, but > they are not hurt either). Yeah, something like that I would greatly appreciate.