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

Re: [PATCH 02/19] t1010: fix unnoticed failure on Windows

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Dec 9, 2021, 16:45 UTC
Message-ID
<CAPig+cR0eKhz+ncWb4v9dSY0A03P+K0+WT90J2cBKvLqT8DXrA@mail.gmail.com>
In-Reply-To
<CABPp-BGBZ6_CqbUg3=sK2b4yELC5NHHyH68_df22n=t=hARH_g@mail.gmail.com>
On Thu, Dec 9, 2021 at 11:28 AM Elijah Newren <newren@gmail.com> wrote:
Show 21 quoted lines
> On Thu, Dec 9, 2021 at 12:22 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
> > The reason this problem has gone unnoticed for so long is twofold.
> > First, the failed `git add` is swallowed silently because the loop is
> > not terminated explicitly by `|| return 1` to signal the failure.
> > Second, none of the tests in this script care about the actual directory
> > names or even the number of tree entries.
>
> Is this true?  The names look like they were selected on the basis that
>     '.' < '/' < '0'
>
> We have multiple paths in the code that write tree structures, and
> it's important that the order be
>   100644 blob $OID1 a.
>   040000 tree $OID2 a
>   100644 blob $OID3 a0
>
> i.e. that 'a' as a tree object sorts as though it were actually named
> 'a/'.  I suspect the code might have been making sure that the
> different paths creating tree objects did so consistently, and the
> special handling of subdirectories is the edge case that needs careful
> checks.

I meant it in the sense that the tests don't care about the literal names "a", "a.", "a0". They do care about ordering...

Show 6 quoted lines
> > Skipping these tests on Windows by, for instance, checking the
> > FUNNYNAMES predicate would avoid the problem, however, the funny-looking
> > name is not what is being tested here. Rather, the tests are about
> > checking that `git mktree` produces stable results for various input
> > conditions, such as when the input order is not consistent or when an
> > object is missing.

... which I hoped to convey to readers by saying "stable results ... when input order is not consistent", but I guess I wasn't clear enough or obvious enough, or this mention is too far removed from the "don't care about the actual names" statement.

Show 6 quoted lines
> > Therefore, resolve the problem simply by using a directory name which is
> > legal on Windows (i.e. "a-" rather than "a."). While at it, add the
> > missing `|| return 1` to the loop body in order to catch this sort of
> > problem in the future.
>
> The choice to replace '.' with '-' is excellent since '-' < '/' as well.

I can rewrite the earlier paragraph to mention name ordering so it's more obvious that it has significance.

I am a bit hesitant about spamming the list with a reroll of this lengthy series just for this change, though I can certainly do it if you consider it important.

Previous: Elijah NewrenNext: Eric Sunshine
Message 5 of 47 in “tests: fix broken &&-chains & abort loops on error”
  1. 00/19 tests: fix broken &&-chains & abort loops on errorEric Sunshine, Dec 9, 2021
  2. 01/19 t/lib-pager: use sane_unset() to avoid breaking &&-chainEric Sunshine, Dec 9, 2021
  3. 02/19 t1010: fix unnoticed failure on WindowsEric Sunshine, Dec 9, 2021
  4. Elijah NewrenDec 9, 2021
  5. Eric SunshineDec 9, 2021
  6. 03/19 t1020: avoid aborting entire test script when one test failsEric Sunshine, Dec 9, 2021
  7. 06/19 t6300: make `%(raw:size) --shell` test more robustEric Sunshine, Dec 9, 2021
  8. Jeff KingDec 10, 2021
  9. 04/19 t4202: clarify intent by creating expected content less cleverlyEric Sunshine, Dec 9, 2021
  10. Jeff KingDec 10, 2021
  11. 05/19 t5516: drop unnecessary subshell and command invocationEric Sunshine, Dec 9, 2021
  12. Jeff KingDec 10, 2021
  13. 07/19 t9107: use shell parameter expansion to avoid breaking &&-chainEric Sunshine, Dec 9, 2021
  14. 08/19 tests: simplify construction of large blocks of textEric Sunshine, Dec 9, 2021
  15. 11/19 tests: fix broken &&-chains in `$(...)` command substitutionsEric Sunshine, Dec 9, 2021
  16. Elijah NewrenDec 9, 2021
  17. Eric SunshineDec 9, 2021
  18. Elijah NewrenDec 9, 2021
  19. Jeff KingDec 10, 2021
  20. 10/19 tests: fix broken &&-chains in compound statementsEric Sunshine, Dec 9, 2021
  21. 09/19 tests: use test_write_lines() to generate line-oriented outputEric Sunshine, Dec 9, 2021
  22. Jeff KingDec 10, 2021
  23. Eric SunshineDec 11, 2021
  24. 12/19 tests: fix broken &&-chains in `{...}` groupsEric Sunshine, Dec 9, 2021
  25. Jeff KingDec 10, 2021
  26. Eric SunshineDec 11, 2021
  27. Fabian StelzerDec 10, 2021
  28. Eric SunshineDec 11, 2021
  29. 13/19 tests: apply modern idiom for signaling test failureEric Sunshine, Dec 9, 2021
  30. Jeff KingDec 10, 2021
  31. Eric SunshineDec 11, 2021
  32. 14/19 tests: apply modern idiom for exiting loop upon failureEric Sunshine, Dec 9, 2021
  33. Jeff KingDec 10, 2021
  34. 16/19 t0000-t3999: detect and signal failure within loopEric Sunshine, Dec 9, 2021
  35. 15/19 tests: simplify by dropping unnecessary `for` loopsEric Sunshine, Dec 9, 2021
  36. Elijah NewrenDec 9, 2021
  37. 17/19 t4000-t4999: detect and signal failure within loopEric Sunshine, Dec 9, 2021
  38. Fabian StelzerDec 10, 2021
  39. Eric SunshineDec 11, 2021
  40. 19/19 t6000-t9999: detect and signal failure within loopEric Sunshine, Dec 9, 2021
  41. 18/19 t5000-t5999: detect and signal failure within loopEric Sunshine, Dec 9, 2021
  42. Elijah NewrenDec 9, 2021
  43. Eric SunshineDec 9, 2021
  44. Jeff KingDec 10, 2021
  45. Fabian StelzerDec 10, 2021
  46. Eric SunshineDec 11, 2021
  47. 2/19 t1010: fix unnoticed failure on WindowsEric Sunshine, Dec 11, 2021

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.