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

Re: [PATCH 6/6] daemon: fix length computation in newline stripping

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jan 25, 2018, 21:38 UTC
Message-ID
<CAPig+cTR39UAbMmKnoi4fhU6EjQp=VGcd0J6=_rS3iD+aixJOg@mail.gmail.com>
In-Reply-To
<20180125005854.GF26850@sigill.intra.peff.net>
On Wed, Jan 24, 2018 at 7:58 PM, Jeff King <peff@peff.net> wrote:
Show 12 quoted lines
> When git-daemon gets a pktline request, we strip off any
> trailing newline, replacing it with a NUL. Clients prior to
> 5ad312bede (in git v1.4.0) would send: [...]
>
> Reported-by: Michael Haggerty <mhagger@alum.mit.edu>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
> @@ -196,5 +196,20 @@ test_expect_success 'daemon log records all attributes' '
> +test_expect_success FAKENC 'hostname interpolation works after LF-stripping' '
> +       {
> +               printf "git-upload-pack /interp.git\n\0host=localhost" | packetize

Do we care about the &&-chain here? (We'd notice if something went wrong in 'packetize' even without &&-chain since 'input' would likely end up with incorrect content, but still...)

Show 11 quoted lines
> +               printf "0000"
> +       } >input &&
> +       fake_nc "$GIT_DAEMON_HOST_PORT" <input >output &&
> +       depacketize <output >output.raw &&
> +
> +       # just pick out the value of master, which avoids any protocol
> +       # particulars
> +       perl -lne "print \$1 if m{^(\\S+) refs/heads/master}" <output.raw >actual &&
> +       git -C "$repo" rev-parse master >expect &&
> +       test_cmp expect actual
> +'
Previous: Jeff KingNext: Jeff King
Message 10 of 13 in “off-by-one errors in git-daemon”
  1. 0/6 off-by-one errors in git-daemonJeff King, Jan 25, 2018
  2. 1/6 t5570: use ls-remote instead of clone for interp testsJeff King, Jan 25, 2018
  3. 2/6 t/lib-git-daemon: record daemon logJeff King, Jan 25, 2018
  4. Lucas WerkmeisterJan 25, 2018
  5. Jeff KingJan 25, 2018
  6. 3/6 daemon: fix off-by-one in logging extended attributesJeff King, Jan 25, 2018
  7. 4/6 daemon: handle NULs in extended attribute stringJeff King, Jan 25, 2018
  8. 5/6 t/lib-git-daemon: add network-protocol helpersJeff King, Jan 25, 2018
  9. 6/6 daemon: fix length computation in newline strippingJeff King, Jan 25, 2018
  10. Eric SunshineJan 25, 2018
  11. Jeff KingJan 26, 2018
  12. Junio C HamanoJan 25, 2018
  13. Jeff KingJan 25, 2018

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.