Subject: Re: [PATCH 2/2] receive-pack: Add receive.denyObjectLimit to refuse push with too many objects

From: Johan Herland <[email-masked]>
Date: Sat, 14 May 2011 03:49:59 +0200

On Friday 13 May 2011, Johannes Sixt wrote:
> Am 13.05.2011 18:54, schrieb Johan Herland:
> > So the pack-objects on the local side dies of a broken pipe (as
> > expected), but the error message from the remote side:
> > 
> >   error: unpack failed: received pack exceeds configured
> >   receive.denyObjectLimit
> > 
> > is never printed, so the user gets no clue as to why the push failed.
> 
> The error message is printed by receive_status(), called around line 350
> in builtin/send-pack.c. But when pack-object fails, then the
> pack_objects() call around line 340 signals an error and an early-exit
> branch is taken, and receive_status() is never called.
> 
> In the test case, only a small amount of data is produced by
> pack-objects, so that it can exit successfully and quickly enough
> because the data fits into the pipe buffer. If the pack-objects process
> were scheduled differently, there is a chance that it dies from SIGPIPE
> as well. So, you are just being lucky that the test case succeeds.

Thanks for the helpful explanation!

Indeed (as Junio already suggested) it seems I must swallow and discard all 
the data sent by the client, and there's no way to easily abort the transfer 
_and_ get the error message printed on the client side. Still, I can at 
least prevent the pack from being stored server-side.

...Johan

-- 
Johan Herland, <[email-masked]>
www.herland.net