git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, Git Mailing List <git@vger.kernel.org>,
	"Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: [BUG] shallow clones over http
Date: Thu, 6 Feb 2014 19:30:33 +0700	[thread overview]
Message-ID: <CACsJy8Bx6voBepHLmmB0qfXx8MHtrBebB2tsan9iQipC-VCVyw@mail.gmail.com> (raw)
In-Reply-To: <7v38txffqn.fsf@alter.siamese.dyndns.org>

(Digging back an old topic after Jeff mentioned it)

On Thu, May 9, 2013 at 2:12 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Jeff King <peff@peff.net> writes:
>
>> I'm trying to track down a protocol bug that happens with shallow clones
>> over smart-http. As far as I can tell, the bug has existed in all
>> versions.
>>
>> You can reproduce it using the attached repository, which is a shallow
>> clone of https://github.com/mileszs/ack.vim.git, like:
>>
>>   $ tar xzf repo.tar.gz
>>   $ cd repo.git
>>   $ git fetch --depth=10
>>   fatal: git fetch-pack: expected shallow list
>>
>> In that test my fetch actually hit github.com as the upstream full repo,
>> but you can also clone it down locally and demonstrate it with purely
>> local copies of git (but it's more of a pain, because you have to set up
>> a smart http server).
>>
>> The last part of the conversation looks like this:
>>
>>   packet:   fetch-pack< 0000
>>   packet:   fetch-pack< ACK f183a345a0c10caed7684d07dabae33e007c7590 common
>>   packet:   fetch-pack> have f183a345a0c10caed7684d07dabae33e007c7590
>>   packet:   fetch-pack< ACK 33312d4db4e91468957b1b41dd039c5d88e85fda common
>>   packet:   fetch-pack< ACK 34d0b2fbc182b31d926632d170bc07d6a6fc3f9b common
>>   packet:   fetch-pack< ACK 45c802e07c60686986474b6b05b2c7048330b6b5 common
>>   packet:   fetch-pack< ACK e93f693fd2a9940d6421bf9e4ddd1f535994eaa5 common
>>   packet:   fetch-pack< ACK 132ee41e8e2c8c545b3aed120171e1596c9211a4 common
>>   packet:   fetch-pack< ACK 973deb3145a99992638b2301cfd654721cf35d68 common
>>   packet:   fetch-pack< ACK e53a88a4e72d84562493313e8911ada4def787da common
>>   packet:   fetch-pack< ACK 90be0bf3eee6f7a0cb9c2377a50610f4ce738da3 common
>>   packet:   fetch-pack< ACK aeab88ccf41bf216fde37983bd403d9b913391e7 common
>>   packet:   fetch-pack< ACK 5f480935d3ce431c393657c3000337bcbdbd5535 common
>>   packet:   fetch-pack< ACK db81e01b433501b159983ea38690aeb01eea1e6b common
>>   packet:   fetch-pack< ACK 06c44b8cab93e780a29ff7f7b5b1dd41dba4b2d5 common
>>   packet:   fetch-pack< ACK 65f3966becdb2d931d5afbdcc6a28008d154668a common
>>   packet:   fetch-pack< ACK 10e8caef9f2ed308231ce1abc326c512e86a5d4c common
>>   packet:   fetch-pack< ACK 6b55dd91f2e7fc64c23eea57e85171cb958f9cd2 common
>>   packet:   fetch-pack< ACK 6b55dd91f2e7fc64c23eea57e85171cb958f9cd2 ready
>>   packet:   fetch-pack< NAK
>>   packet:   fetch-pack< ACK 6b55dd91f2e7fc64c23eea57e85171cb958f9cd2
>>   fatal: git fetch-pack: expected shallow list
>>
>> So we see that upload-pack sends a bunch of detailed ACKs, followed by a
>> NAK, and then it sends another ACK.
>>
>> Fetch-pack is inside find_common, reading these acks. At the beginning
>> of each stateless-rpc response, it expects to consume any
>> shallow/unshallow lines up to a flush packet (the call to
>> consume_shallow_list). And then it reads the acks in a loop. After it
>> sees the NAK, it assumes that the server is done sending the packet, and
>> loops again, expecting another set of shallow/unshallow lines. But we
>> get the next ACK instead, and die.
>>
>> So who is wrong? Is upload-pack wrong to send an ACK after the NAK?
>
> 3e63b21aced1 (upload-pack: Implement no-done capability, 2011-03-14)
> claims that the above sequence of acks and naks is what upload-pack
> wants to show.
>
> What happens when you disable no-done extension handling on the
> server end, I wonder?

fetch succeeded when no-done was disabled. An immediate workaround
would be disable no-done in fetch-pack.c in a shallow repo but maybe
we can do better..
-- 
Duy

      reply	other threads:[~2014-02-06 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03  4:03 [BUG] shallow clones over http Jeff King
2013-04-10 12:01 ` Tom
2013-04-10 12:14   ` Ramkumar Ramachandra
2013-04-10 12:48   ` Tom
2013-04-13  6:03     ` Jeff King
2013-05-08 19:12 ` Junio C Hamano
2014-02-06 12:30   ` Duy Nguyen [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=CACsJy8Bx6voBepHLmmB0qfXx8MHtrBebB2tsan9iQipC-VCVyw@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=spearce@spearce.org \
    /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;
as well as URLs for NNTP newsgroup(s).