Re: [PATCH v3 9/9] fixup! remote-curl: error on incomplete packet
- From
Jeff King <peff@peff.net>
- Date
- May 22, 2020, 16:31 UTC
- Message-ID
- <20200522163123.GA2147475@coredump.intra.peff.net>
- In-Reply-To
- <20200522160552.GA677085@generichostname>
On Fri, May 22, 2020 at 12:05:52PM -0400, Denton Liu wrote:
Show 14 quoted lines
> Hi Peff, > > On Fri, May 22, 2020 at 11:54:10AM -0400, Jeff King wrote: > > > -printf "%s\n" "00" > > > +printf "%s" "00" > > > > This one is a behavior improvement: we were probably hitting "oops, > > newline isn't a valid line-length character" before, and now we're > > really hitting the truncated packet. > > The test currently actually greps for the "incomplete length" error > message and it passes so the behaviour remains the same. We just got > lucky that we send "00" instead of "000" beacuse "000\n" would've > otherwise given us a full length header.
Ah, OK. I was surprised it didn't hit your new code in check_pktline() that complains about non-hex chars. But the reason is that we don't check digit-by-digit as we read them. We wait until we have 4 chars, and then we feed the whole thing to packet_length(). But since we only receive 3, the state machine doesn't move to that step. So that makes sense.
> > I don't know if it's worth adding an extra test with a bogus > > line-length. I'm OK with with it either way. > > I think I'll leave this unless anyone really wants this to be tested.
Sounds good.
-Peff