Thread (70 messages) 70 messages, 3 authors, 7d ago

Re: [PATCH v3 4/5] promisor-remote: prevent infinite recursion when lazy fetching

flat view

From: Junio C Hamano <hidden>
Date: 2026-09-08 18:12:22

Christian Couder [off-list ref] writes:
It does not recurse forever in practice, but only because each level
adds one more variable to the environment of the child process, so
after a while `exec()` fails with:

    fatal: cannot exec 'git-upload-pack ...': Argument list too long
    fatal: unable to fork

To avoid this pathological case altogether, let's use a new
`GIT_INTERNAL_LAZY_FETCH_DEPTH` to count the recursion depth, and let's
check that it doesn't exceed a MAX_LAZY_FETCH_DEPTH limit (set to 5 for
now).
Good.

Does it have to be "unsigned long", though?  Just like oid_nr, I'd
prefer to see a number whose range or signedness does not matter in
practice be typed as platform natural "int".  Even though one could
argue that "anything_nr cannot be negative so it must be unsigned",
or "int might be too small for some platforms" or "int or ulong have
different width on different platforms", or even "anything we count
we should count in size_t", I do not think any of them is a good
argument against it, especially when the value we start with is 5
;-).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help