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

Re: [PATCH 01/28] t/test-lib: add an SHA1 prerequisite

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
May 7, 2018, 23:30 UTC
Message-ID
<20180507233000.GI953644@genre.crustytoothpaste.net>
In-Reply-To
<CAN0heSqk0siv4y5BGz2+sLhAyNG=TEZmgucKoCDGyx2i8_O+tQ@mail.gmail.com>
On Mon, May 07, 2018 at 12:10:39PM +0200, Martin Ågren wrote:
Show 6 quoted lines
> On 7 May 2018 at 01:17, brian m. carlson <sandals@crustytoothpaste.net> wrote:
> > Add an SHA1 prerequisite to annotate both of these types of tests and
> > disable them when we're using a different hash.  In the future, we can
> > create versions of these tests which handle both SHA-1 and NewHash.
> 
> Minor nit: s/can/can and should/
I agree with that sentiment.  I can change that.
Show 11 quoted lines
> > +
> > +# SHA1 is a test if the hash algorithm in use is SHA-1.  This is both for tests
> > +# which will not work with other hash algorithms and tests that work but don't
> > +# test anything meaningful (e.g. special values which cause short collisions).
> > +test_lazy_prereq SHA1 '
> > +       test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
> > +'
> 
> So SHA1 means roughly "git hash-object uses SHA-1, so supposedly
> everything on disk is SHA-1." I could imagine one or two different
> meanings: "Git was compiled with support for SHA-1 [oids]."

Currently it means that, yes. It may specialize to mean, "git emits SHA-1 output, regardless of the format on disk." See cases 1 and 2 below.

> Do we actually need more SHA-1-related prereqs, at least long-term, in
> which case we would want to find a more specific name for this one now?
> Is this SHA1_STORAGE, or some much better name than that?
We may.  The transition plan anticipates several states:
1. Store data in NewHash, but input and output are SHA-1.
2. Store data in NewHash; output is SHA-1; input can be either.
3. Store data and output in NewHash; input can be either.
4. All NewHash.

At this point, I'm working on getting the tests to handle case 4, as that's actually the easiest to fix (because if things are wrong, the code tends to segfault). Case 1 will be next, in which case, we may need SHA1_STORAGE or such.

I plan to make the SHA1 prerequisite go away or at least be far less used in a few releases. Once we know what NewHash is going to be, it's pretty easy to write tooling and translation tables that do the conversion for most tests, and a test helper can simply emit the right output for whichever algorithm we're using in that situation, whether that's the on-disk algorithm, the input algorithm, or the output algorithm.

Show 6 quoted lines
> I am thinking for example about a repo with NewHash that gets pushed to
> and fetched from a SHA-1 server, see hash-function-transition.txt, goal
> 1b. We'd want to always test that SHA-1-related functionality in git.
> (But only until the day when someone defines a prereq such as "SHA1" to
> be able to test a git that was compiled without any traces of SHA-1
> whatsoever.)

I anticipate that by the time we get to that point, the SHA1 prerequisite will be long gone and can be reused for that purpose, should we need it.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Martin ÅgrenNext: Martin Ågren
Message 4 of 46 in “Hash-independent tests (part 2)”
  1. 00/28 Hash-independent tests (part 2)brian m. carlson, May 6, 2018
  2. 01/28 t/test-lib: add an SHA1 prerequisitebrian m. carlson, May 6, 2018
  3. Martin ÅgrenMay 7, 2018
  4. brian m. carlsonMay 7, 2018
  5. Martin ÅgrenMay 8, 2018
  6. brian m. carlsonMay 8, 2018
  7. 02/28 t/test-lib: introduce ZERO_OIDbrian m. carlson, May 6, 2018
  8. 03/28 t: switch $_z40 to $ZERO_OIDbrian m. carlson, May 6, 2018
  9. 04/28 t/test-lib: introduce FULL_HEXbrian m. carlson, May 6, 2018
  10. Eric SunshineMay 6, 2018
  11. brian m. carlsonMay 7, 2018
  12. 05/28 t: switch $_x40 to $FULL_HEXbrian m. carlson, May 6, 2018
  13. 06/28 t0000: annotate with SHA1 prerequisitebrian m. carlson, May 6, 2018
  14. Martin ÅgrenMay 7, 2018
  15. brian m. carlsonMay 7, 2018
  16. Martin ÅgrenMay 8, 2018
  17. brian m. carlsonMay 9, 2018
  18. 07/28 t1007: annotate with SHA1 prerequisitebrian m. carlson, May 6, 2018
  19. 09/28 t4044: skip test if not using SHA-1brian m. carlson, May 6, 2018
  20. 10/28 t: skip pack tests if not using SHA-1brian m. carlson, May 6, 2018
  21. Martin ÅgrenMay 7, 2018
  22. 12/28 t3103: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  23. 11/28 t2203: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  24. 14/28 t3905: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  25. Eric SunshineMay 7, 2018
  26. brian m. carlsonMay 7, 2018
  27. 16/28 t4008: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  28. Eric SunshineMay 7, 2018
  29. brian m. carlsonMay 7, 2018
  30. 17/28 t4014: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  31. 20/28 t4029: fix test indentationbrian m. carlson, May 6, 2018
  32. 21/28 t4029: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  33. 22/28 t4030: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  34. 24/28 t4205: sort log output in a hash-independent waybrian m. carlson, May 6, 2018
  35. 25/28 t4042: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  36. 23/28 t/lib-diff-alternative: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  37. 27/28 t4208: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  38. 28/28 t5300: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  39. 26/28 t4045: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  40. 18/28 t4020: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  41. 19/28 t4022: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  42. 08/28 t1512: skip test if not using SHA-1brian m. carlson, May 6, 2018
  43. 15/28 t4007: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  44. 13/28 t3702: abstract away SHA-1-specific constantsbrian m. carlson, May 6, 2018
  45. Eric SunshineMay 7, 2018
  46. brian m. carlsonMay 7, 2018

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.