Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Kristofer Karlsson <krka@spotify.com>
Cc: Kristofer Karlsson via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org, Elia Pinto <gitter.spiros@gmail.com>,
	Elijah Newren <newren@gmail.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Harald Nordgren <haraldnordgren@gmail.com>
Subject: Re: [PATCH] tree-walk: reject tree entries whose name length overflows an int
Date: Wed, 2 Dec 2026 08:27:27 +0100	[thread overview]
Message-ID: <aw_IX7W85LvULa-z@pks.im> (raw)
In-Reply-To: <CAL71e4NovJixz3k3yjDyShGtmgLeL5J7Kog0E=a1C=u-CuWr9A@mail.gmail.com>

On Tue, Dec 01, 2026 at 04:58:56PM +0100, Kristofer Karlsson wrote:
> On Tue, 1 Dec 2026 at 16:11, Patrick Steinhardt <ps@pks.im> wrote:
> > On Mon, Nov 30, 2026 at 02:42:52PM +0000, Kristofer Karlsson via GitGitGadget wrote:
> > > From: Kristofer Karlsson <krka@spotify.com>
> > We can then still adapt `struct name_entry::len` at a later point in
> > time.
> >
> > Ideally, we'd also have documentation around this somewhere to spell out
> > that tree entries may at most be INT32_MAX.
> 
> I am not sure it is worth it.  The filesystem limits of paths
> and/or names are much lower than 2^31 anyway so this limit
> is unlikely to hit (or even impossible?) for any real users.

True, but it's still possible to generate such tree entries regardless
of that, for example via git-mktree(1) or git-hash-object(1). You
wouldn't ever be able to check those out, but no matter which limit we
pick there will always be some platforms that won't be able to do that.

> I also could not really find any suitable document to put it
> in, and I think the other limits that are documented are ones
> that are more practically reachable.  One exception may be
> index.maxPathLen in config/index.adoc, which mentions the same
> limit, but that is documented because it is a config option
> and thus needs to say which values are accepted, so it is
> not fully comparable.

I think the best place to add that to would be gitdatamodel(7). We
already document the object formats in there, so it might be a natural
place to add this limitation. E.g.:

diff --git a/Documentation/gitdatamodel.adoc b/Documentation/gitdatamodel.adoc
index 056b866f254..53927622987 100644
--- a/Documentation/gitdatamodel.adoc
+++ b/Documentation/gitdatamodel.adoc
@@ -85,7 +85,7 @@ tree::
     It can contain files or other trees (which are subdirectories).
     It lists, for each item in the tree:
 +
-1. The *filename*, for example `hello.py`
+1. The *filename*, for example `hello.py`, which may not be longer than XYZ bytes
 2. The *file type*, which must be one of these five types:
   - *regular file*
   - *executable file*

Thanks!

Patrick

      reply	other threads:[~2026-12-02  7:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 14:42 [PATCH] tree-walk: reject tree entries whose name length overflows an int Kristofer Karlsson via GitGitGadget
2026-12-01 15:11 ` Patrick Steinhardt
2026-12-01 15:58   ` Kristofer Karlsson
2026-12-02  7:27     ` Patrick Steinhardt [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aw_IX7W85LvULa-z@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitter.spiros@gmail.com \
    --cc=haraldnordgren@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=krka@spotify.com \
    --cc=newren@gmail.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox