git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] Improve progress display in kB range.

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Apr 23, 2009, 06:23 UTC
Message-ID
<49F0094A.6020609@viscovery.net>
In-Reply-To
<m3ab68mi3q.fsf@lugabout.jhcloos.org>
James Cloos schrieb:
Show 48 quoted lines
>>>>>> "Junio" == Junio C Hamano <gitster@pobox.com> writes:
> 
> Junio> If input_buffer[ret] _were_ the last octet read, [the] loop would
> Junio> be discarding that octet when [it] call[s] more than one xread()
> Junio> to fill the buffer.
> 
> That did sem more likely, but I thought I'd throw out the possibility.
> 
> I just tried instrumenting fill().
> 
> In the first call to fill() during a fetch, xread() returns 4096.  In
> the second call to fill(), xread() returns 4095.  In all subsequent
> calls to fill(), xread() returns 4096 again.
> 
> So, after the second call to xread(), consumed_bytes & 0xFFF == 0xFFF.
> 
> It always follows the pattern:
> 
> xread() read 0x1000 from fd 0 at 0x80a0900
> ret = 0x1000
> consumed_bytes = 0
> input_len = 0x1000
> 
> xread() read 0xFFF from fd 0 at 0x80a0900
> ret = 0xFFF
> consumed_bytes = 0x1000
> input_len = 0xFFF
> 
> xread() read 0x1000 from fd 0 at 0x80a0900
> ret = 0x1000
> consumed_bytes = 0x1FFF
> input_len = 0x1000
> 
> with all subsequent calls reading 0x1000 and adding 0x1000 to
> consumed_bytes, until the final chuck of tha pack is read.
> 
> Also, all calls to xread() where the status lines are being sent from
> the remote server also return 0x1000 octets.  Only the second chunck of
> a pack ever returns 0xFFF.
> 
> I've tested against a number of remote servers and the pattern holds for
> a wide range of remote server versions.
> 
> The pattern also holds for clones over ssh.
> 
> Does anyone have an idea of why the second call to read(2), when
> receiving a pack from a remote, always leaves the last octet of the
> buffer free, whereas all other read(2)s fill it?

You could instrument upload-pack.c. There is an xread() around l.237; does it aways return 4096? And send_client_data() at around l.254; when does it send 4096 and when 4095 bytes? Read the comment in this if-branch.

upload-pack is run on the server-side; therefore, you can test this only on local repositories (unless you can replace upload-pack on the server, too).

-- Hannes
Previous: James CloosNext: James Cloos
Message 10 of 13 in “Improve progress display in kB range.”
  1. 0/1 Improve progress display in kB range.James Cloos, Apr 19, 2009
  2. 1/1 Improve progress display in kB range.James Cloos, Apr 19, 2009
  3. Nicolas PitreApr 21, 2009
  4. James CloosApr 21, 2009
  5. Nicolas PitreApr 21, 2009
  6. James CloosApr 21, 2009
  7. James CloosApr 22, 2009
  8. Junio C HamanoApr 22, 2009
  9. James CloosApr 22, 2009
  10. Johannes SixtApr 23, 2009
  11. James CloosApr 24, 2009
  12. Nicolas PitreApr 24, 2009
  13. James CloosApr 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.