From: Eric Sunshine Date: Thu, 25 Jan 2018 21:38:20 GMT Subject: Re: [PATCH 6/6] daemon: fix length computation in newline stripping Message-ID: In-Reply-To: <20180125005854.GF26850@sigill.intra.peff.net> On Wed, Jan 24, 2018 at 7:58 PM, Jeff King wrote: > 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 > Signed-off-by: Jeff King > --- > 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...) > + printf "0000" > + } >input && > + fake_nc "$GIT_DAEMON_HOST_PORT" output && > + depacketize output.raw && > + > + # just pick out the value of master, which avoids any protocol > + # particulars > + perl -lne "print \$1 if m{^(\\S+) refs/heads/master}" actual && > + git -C "$repo" rev-parse master >expect && > + test_cmp expect actual > +'