git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git in Outreachy December 2019?

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Sep 26, 2019, 21:44 UTC
Message-ID
<20190926214448.GI2637@szeder.dev>
In-Reply-To
<nycvar.QRO.7.76.6.1909262138450.15067@tvgsbejvaqbjf.bet>
On Thu, Sep 26, 2019 at 09:39:58PM +0200, Johannes Schindelin wrote:
Show 24 quoted lines
> Hi,
> 
> On Thu, 26 Sep 2019, SZEDER Gábor wrote:
> 
> > On Thu, Sep 26, 2019 at 01:04:48PM +0200, Johannes Schindelin wrote:
> > > > > > > Also, things like the code tracing via `-x` (which relies on Bash
> > > > > > > functionality in order to work properly,
> > > > > >
> > > > > > Not really.
> > > > >
> > > > > To work properly. What I meant was the trick we need to play with
> > > > > `BASH_XTRACEFD`.
> > > >
> > > > I'm still unsure what BASH_XTRACEFD trick you mean.  AFAICT we don't
> > > > play any tricks with it to make '-x' work properly, and indeed '-x'
> > > > tracing works properly even without BASH_XTRACEFD (and to achive that
> > > > we did have to play some tricks, but not any with BASH_XTRACEFD;
> > > > perhaps these tricks are what you meant?).
> > >
> > > It works okay some of the time.
> >
> > As far as I can tell it works all the time.
> 
> I must be misinterpreting this part of `t/test-lib.sh`, then:
Ok, let me try to clarify.

There are a couple of things that we can't do in our tests without BASH_XTRACEFD, e.g. redirecting the standard error of a subshell or a loop to a file and then check that file with 'test_cmp' or 'test_must_be_empty'. With tracing enabled but without BASH_XTRACEFD, the trace of the commands executed within the subshell or loop end up in that file as well, and cause failure (grepping through that file is mostly ok, though). Back then we had 23 test cases failing because they were doing things like this and needed to be fixed, so considering the total number of test cases we only rarely used such problematic constructs.

Still, as I recall, Peff was concerned that these limitations might lead to maintenance burden on the long run, so I decided to add an escape hatch, just in case someone constructs such an elaborate test script, where redirecting the stderr of a compound command could considerably simplify the tests.

That snippet of code that you copied is this escape hatch: if $test_untraceable is set to a non-empty value before sourcing 'test-lib.sh', then tracing will only be enabled if BASH_XTRACEFD is available.

All that was over a year and a half ago, and these limitations weren't a maintenance burden at all so far, and nobody needed that escape hatch.

Well, nobody except me, that is :) When I saw back then that t1510 saves the stderr of nested function calls with 7 parameters, I shrugged in disgust, admitted defeat, and simply reached for that escape hatch: partly because I couldn't be bothered to figure out how that test script works, but more importantly because I didn't want to risk that any cleanup inadvertently hides a bug in the future.

So that's the only user that piece of code ever had, and I certainly hope that no other test script will ever grow so complicated that it will need this escape hatch. I would actually prefer to remove it, but t1510 must be cleaned up first... so I'm afraid it will be with us for a while.

Show 24 quoted lines
> -- snipsnap --
> if test -n "$trace" && test -n "$test_untraceable"
> then
> 	# '-x' tracing requested, but this test script can't be reliably
> 	# traced, unless it is run with a Bash version supporting
> 	# BASH_XTRACEFD (introduced in Bash v4.1).
> 	#
> 	# Perform this version check _after_ the test script was
> 	# potentially re-executed with $TEST_SHELL_PATH for '--tee' or
> 	# '--verbose-log', so the right shell is checked and the
> 	# warning is issued only once.
> 	if test -n "$BASH_VERSION" && eval '
> 	     test ${BASH_VERSINFO[0]} -gt 4 || {
> 	       test ${BASH_VERSINFO[0]} -eq 4 &&
> 	       test ${BASH_VERSINFO[1]} -ge 1
> 	     }
> 	   '
> 	then
> 		: Executed by a Bash version supporting BASH_XTRACEFD.  Good.
> 	else
> 		echo >&2 "warning: ignoring -x; '$0' is untraceable without BASH_XTRACEFD"
> 		trace=
> 	fi
> fi
Previous: Johannes SchindelinNext: Jeff King
Message 32 of 63 in “Git in Outreachy December 2019?”
  1. Jeff KingAug 27, 2019
  2. Christian CouderAug 31, 2019
  3. Olga TelezhnayaAug 31, 2019
  4. Jeff KingSep 4, 2019
  5. Christian CouderSep 5, 2019
  6. Emily ShafferSep 5, 2019
  7. Carlo ArenasSep 6, 2019
  8. Jeff KingSep 7, 2019
  9. Carlo ArenasSep 7, 2019
  10. Jeff KingSep 7, 2019
  11. Pratyush YadavSep 8, 2019
  12. Jeff KingSep 9, 2019
  13. SZEDER GáborSep 23, 2019
  14. SZEDER GáborSep 26, 2019
  15. Johannes SchindelinSep 26, 2019
  16. SZEDER GáborSep 26, 2019
  17. Johannes SchindelinSep 26, 2019
  18. Jonathan TanSep 13, 2019
  19. Jeff KingSep 13, 2019
  20. Emily ShafferSep 16, 2019
  21. Eric WongSep 16, 2019
  22. SZEDER GáborSep 16, 2019
  23. Jonathan NiederSep 16, 2019
  24. Jeff KingSep 17, 2019
  25. Johannes SchindelinSep 17, 2019
  26. SZEDER GáborSep 17, 2019
  27. Johannes SchindelinSep 23, 2019
  28. SZEDER GáborSep 23, 2019
  29. Johannes SchindelinSep 26, 2019
  30. SZEDER GáborSep 26, 2019
  31. Johannes SchindelinSep 26, 2019
  32. SZEDER GáborSep 26, 2019
  33. Jeff KingSep 27, 2019
  34. SZEDER GáborOct 9, 2019
  35. Jeff KingOct 11, 2019
  36. Jeff KingSep 23, 2019
  37. Johannes SchindelinSep 24, 2019
  38. Christian CouderSep 17, 2019
  39. Johannes SchindelinSep 23, 2019
  40. Jeff KingSep 23, 2019
  41. Jeff KingSep 23, 2019
  42. Johannes SchindelinSep 24, 2019
  43. Jeff KingSep 24, 2019
  44. Junio C HamanoSep 28, 2019
  45. Eric WongSep 24, 2019
  46. Johannes SchindelinSep 26, 2019
  47. Eric WongSep 30, 2019
  48. Junio C HamanoSep 28, 2019
  49. Jonathan TanSep 20, 2019
  50. Emily ShafferSep 21, 2019
  51. Christian CouderSep 23, 2019
  52. Jeff KingSep 23, 2019
  53. Philip OakleySep 23, 2019
  54. Emily ShafferOct 22, 2019
  55. Christian CouderSep 23, 2019
  56. Jonathan TanSep 23, 2019
  57. Jeff KingSep 23, 2019
  58. Jonathan TanSep 23, 2019
  59. Jeff KingSep 23, 2019
  60. Jonathan TanSep 23, 2019
  61. Jeff KingSep 23, 2019
  62. Jonathan TanSep 24, 2019
  63. Jeff KingSep 26, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.