git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Victoria Dye <vdye@github.com>,
	Derrick Stolee <derrickstolee@github.com>,
	git@vger.kernel.org
Subject: Re: t9210-scalar.sh fails with SANITIZE=undefined
Date: Thu, 22 Sep 2022 15:56:21 -0700	[thread overview]
Message-ID: <xmqq7d1vxbl6.fsf@gitster.g> (raw)
In-Reply-To: <YyzhR8CGu2CNQMfJ@coredump.intra.peff.net> (Jeff King's message of "Thu, 22 Sep 2022 18:27:19 -0400")

Jeff King <peff@peff.net> writes:

> I also wondered why other versions do not have a similar problem. After
> all, cache entries contain pathnames which are going to be of varying
> lengths. But this seems telling:
>
>   $ git grep -m1 -B1 -A2 align_padding_size
>   read-cache.c-/* These are only used for v3 or lower */
>   read-cache.c:#define align_padding_size(size, len) ((size + (len) + 8) & ~7) - (size + len)
>   read-cache.c-#define align_flex_name(STRUCT,len) ((offsetof(struct STRUCT,data) + (len) + 8) & ~7)
>   read-cache.c-#define ondisk_cache_entry_size(len) align_flex_name(ondisk_cache_entry,len)
>
> So we actually pad the entries in earlier versions to align them, but
> don't in v4. I'm not sure if that was a conscious choice to save space,
> or an unintended consequence (though it is mentioned in the docs, I
> think that came after the code).

I think we didn't even have on-disk vs in-core distinction in the
early index code.  The active_cache[] array used to be an array of
pointers into the (read-only) mmapped memory, peeking into on-disk
index we just "read".  Back when v4 was introduced, that arrangement
was (thought to be) long gone---we iterated over the mmapped memory
and used create_from_disk() to munge the on-disk representation into
a machine native form.  At that point, there was no point in having
the padding---we are supposed to be using get_beXX() and stuff
without having to worry about alignment requirements.


      reply	other threads:[~2022-09-22 22:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 10:04 t9210-scalar.sh fails with SANITIZE=undefined Jeff King
2022-09-22 12:35 ` Derrick Stolee
2022-09-22 19:12   ` Jeff King
2022-09-22 22:09     ` Victoria Dye
2022-09-22 22:27       ` Jeff King
2022-09-22 22:56         ` Junio C Hamano [this message]

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=xmqq7d1vxbl6.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=vdye@github.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).