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

Re: [ANNOUNCE] Git v2.23.0-rc0 - Initial test failures on NonStop

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 30, 2019, 20:39 UTC
Message-ID
<xmqqpnlrs1d7.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190730200203.GA4882@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> @@ -116,19 +116,11 @@ unsigned int memihash_cont(unsigned int hash_seed, const void *buf, size_t len);
>   * Converts a cryptographic hash (e.g. SHA-1) into an int-sized hash code
>   * for use in hash tables. Cryptographic hashes are supposed to have
>   * uniform distribution, so in contrast to `memhash()`, this just copies
> - * the first `sizeof(int)` bytes without shuffling any bits. Note that
> - * the results will be different on big-endian and little-endian
> - * platforms, so they should not be stored or transferred over the net.
;-)
Show 35 quoted lines
> + * the first `sizeof(int)` bytes without shuffling any bits.
>   */
>  static inline unsigned int oidhash(const struct object_id *oid)
>  {
> -	/*
> -	 * Equivalent to 'return *(unsigned int *)oid->hash;', but safe on
> -	 * platforms that don't support unaligned reads.
> -	 */
> -	unsigned int hash;
> -	memcpy(&hash, oid->hash, sizeof(hash));
> -	return hash;
> +	return get_be32(oid->hash);
>  }
>  
>  /*
> diff --git a/t/t0016-oidmap.sh b/t/t0016-oidmap.sh
> index bbe719e950..6656db9d69 100755
> --- a/t/t0016-oidmap.sh
> +++ b/t/t0016-oidmap.sh
> @@ -93,9 +93,9 @@ put three 3
>  iterate" "NULL
>  NULL
>  NULL
> +$(git rev-parse three) 3
>  $(git rev-parse two) 2
> -$(git rev-parse one) 1
> -$(git rev-parse three) 3"
> +$(git rev-parse one) 1"
>  
>  '
>
> which not only fixes this test but any other hash-based oddities. I
> wonder if it's appreciably less efficient. I'll bet I could nerd-snipe
> René into doing a bunch of measurements and explorations of the
> disassembled code. ;)

I'd rather see us go in the direction of discouraging people from relying on the hash order.

Previous: Jeff KingNext: SZEDER Gábor
Message 10 of 24 in “RE: [ANNOUNCE] Git v2.23.0-rc0 - Initial test failures on NonStop”
  1. Randall S. BeckerJul 30, 2019
  2. Junio C HamanoJul 30, 2019
  3. Matheus Tavares BernardinoJul 30, 2019
  4. Randall S. BeckerJul 30, 2019
  5. Junio C HamanoJul 30, 2019
  6. Jeff KingJul 30, 2019
  7. Randall S. BeckerJul 30, 2019
  8. Todd ZullingerJul 30, 2019
  9. Jeff KingJul 30, 2019
  10. Junio C HamanoJul 30, 2019
  11. SZEDER GáborJul 30, 2019
  12. Jeff KingJul 31, 2019
  13. Jeff KingJul 31, 2019
  14. Jeff KingJul 31, 2019
  15. Todd ZullingerJul 31, 2019
  16. Jeff KingJul 31, 2019
  17. Jeff KingJul 31, 2019
  18. Junio C HamanoJul 31, 2019
  19. non-cryptographic hash algorithms in gitJeff King, Jul 31, 2019
  20. René ScharfeJul 31, 2019
  21. Jeff KingJul 31, 2019
  22. Todd ZullingerJul 31, 2019
  23. Junio C HamanoJul 31, 2019
  24. Randall S. BeckerJul 30, 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.