Re: [PATCH 7/9] ls-refs: ignore very long ref-prefix counts
- From
Jeff King <peff@peff.net>
- Date
- Sep 14, 2021, 22:15 UTC
- Message-ID
- <YUEfDBjAAsH9SLeY@coredump.intra.peff.net>
- In-Reply-To
- <YUEeFENv04Ht5zXd@nand.local>
On Tue, Sep 14, 2021 at 06:11:32PM -0400, Taylor Blau wrote:
Show 24 quoted lines
> On Tue, Sep 14, 2021 at 06:09:45PM -0400, Jeff King wrote:
> > On Tue, Sep 14, 2021 at 11:37:06AM -0400, Jeff King wrote:
> >
> > > +test_expect_success 'ignore very large set of prefixes' '
> > > + # generate a large number of ref-prefixes that we expect
> > > + # to match nothing; the value here exceeds MAX_ALLOWED_PREFIXES
> > > + # from ls-refs.c.
> > > + {
> > > + echo command=ls-refs &&
> > > + echo object-format=$(test_oid algo)
> > > + echo 0001 &&
> > > + perl -le "print \"refs/heads/$_\" for (1..65536+1)" &&
> > > + echo 0000
> > > + } |
> > > + test-tool pkt-line pack >in &&
> >
> > Yuck. While double-checking some refactoring, I realized this test does
> > not actually generate the correct input!
> >
> > It omits the "ref-prefix" header. _And_ it accidentally expands $_ in
> > the shell rather than in perl.
>
> Hah, nice find. You'd think that one of us would have caught it earlier
> given that we both discussed it.Really, I'd have thought that ls-refs would complain about a totally bogus capability. I'll see if I can fix that, as well.
-Peff