git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Josh Steadmon <steadmon@google.com>,
	Jeff Hostetler <jeffhost@microsoft.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] test-lib: unset trace2 parent envvars
Date: Tue, 18 Jan 2022 16:29:04 -0500	[thread overview]
Message-ID: <YecxIJpaAzXRjGJG@nand.local> (raw)
In-Reply-To: <xmqq35lqetzw.fsf@gitster.g>

On Thu, Jan 13, 2022 at 10:01:07PM -0800, Junio C Hamano wrote:
> Josh Steadmon <steadmon@google.com> writes:
>
> > This behavior breaks certain tests that examine trace2 output when the
> > tests run as a child of another git process, such as in `git rebase -x
> > "make test"`.
>
> Well explained.  The paragraph makes it clear how easy to trigger
> and get bitten by this problem.
>
> > While we could fix this by unsetting the relevant variables in the
> > affected tests (currently t0210, t0211, t0212, and t6421), this would
> > leave other tests vulnerable to similar breakage if new test cases are
> > added which inspect trace2 output. So fix this in general by unsetting
> > GIT_TRACE2_PARENT_NAME and GIT_TRACE2_PARENT_SID in test-lib.sh.
>
> This probably makes sense, but I wonder how it interacts with a user
> who runs "cd t && GIT_TRACE2=blah ./t0987-test-this.sh" to trace the
> entire test script, though.
>
> > Reported-by: Emily Shaffer <emilyshaffer@google.com>
> > Helped-by: Jonathan Tan <jonathantanmy@google.com>
> > Signed-off-by: Josh Steadmon <steadmon@google.com>
> > ---
> >  t/test-lib.sh | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/t/test-lib.sh b/t/test-lib.sh
> > index 0f7a137c7d..e4716b0b86 100644
> > --- a/t/test-lib.sh
> > +++ b/t/test-lib.sh
> > @@ -449,6 +449,8 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
> >  unset XDG_CACHE_HOME
> >  unset XDG_CONFIG_HOME
> >  unset GITPERLLIB
> > +unset GIT_TRACE2_PARENT_NAME
> > +unset GIT_TRACE2_PARENT_SID
>
> Hmph.  Have you noticed the more generic "We want to unset almost
> everything that begins with GIT_, other than those selected few that
> are designed to be used to affect the tests" above the part you
> touched?
>
> I am wondering if we should tweak the list there, instead of special
> casing these two and these two only. There is a pattern that allows
> anything that match "^GIT_(other|TRACE|things)", and I suspect that
> the pattern is way too loose (i.e. it allows any garbage to follow,
> and by allowing "TRACE", it also catches "TRACE2" because the former
> is a prefix of the latter), which is a problem.

I was thinking the same thing, but I suspect that this may truly be
different. That list says we should be able to keep anything that looks
like GIT_TRACE in our environment. So the same should be true of
TRACE2-related variables, I'd think.

But the PARENT_NAME and PARENT_SID variables are (as far as I can tell
from reading around) internal variables that help us piece together the
names of the Git commands we ran.

In other words, excluding all TRACE2 variables goes too far since it
prevents us from being able to `GIT_TRACE2=1 make test`. But we would
want to clear out any internal TRACE2 variables such as PARENT_NAME and
PARENT_SID.

Thanks,
Taylor

  parent reply	other threads:[~2022-01-18 21:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14  3:33 [PATCH] test-lib: unset trace2 parent envvars Josh Steadmon
2022-01-14  6:01 ` Junio C Hamano
2022-01-18 21:23   ` Josh Steadmon
2022-01-18 21:50     ` Junio C Hamano
2022-01-26 22:11       ` Josh Steadmon
2022-01-18 21:29   ` Taylor Blau [this message]
2022-01-26 22:10 ` [PATCH v2] " Josh Steadmon
2022-01-27  3:23   ` Ævar Arnfjörð Bjarmason
2022-01-27 18:29     ` Junio C Hamano
2022-02-01 21:22     ` Josh Steadmon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YecxIJpaAzXRjGJG@nand.local \
    --to=me@ttaylorr.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    --cc=steadmon@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).