Re: [PATCH 1/6] sha1-file.c: remove the_repo from read_object_with_reference()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 27, 2019 at 7:54 PM Johannes Schindelin
<Johannes.Schindelin@xxxxxx> wrote:
>
> Hi Duy,
>
> On Mon, 24 Jun 2019, Nguyễn Thái Ngọc Duy wrote:
>
> > diff --git a/builtin/grep.c b/builtin/grep.c
> > index 580fd38f41..85da7ee542 100644
> > --- a/builtin/grep.c
> > +++ b/builtin/grep.c
> > @@ -458,7 +458,8 @@ static int grep_submodule(struct grep_opt *opt,
> >               object = parse_object_or_die(oid, oid_to_hex(oid));
> >
> >               grep_read_lock();
> > -             data = read_object_with_reference(&object->oid, tree_type,
> > +             data = read_object_with_reference(opt->repo,
> > +                                               &object->oid, tree_type,
>
> Junio's hunch was absolutely spot on. This conversion is incorrect. If you
> replace this `opt->repo` and...
>
> >                                                 &size, NULL);
> >               grep_read_unlock();
> >
> > @@ -623,7 +624,8 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
> >               int hit, len;
> >
> >               grep_read_lock();
> > -             data = read_object_with_reference(&obj->oid, tree_type,
> > +             data = read_object_with_reference(opt->repo,
>
> ... this one with `the_repository`, t7814 starts passing again.
>
> It makes me very wary of this patch series that this bug has only been
> caught by a CI build. You probably did not run the test suite before
> sending this patch series.

I did. After Junio reported, I've ran a lot more and had the same
pass/fail-sometimes behavior.

> I also wonder what the rationale was to deviate from the strategy used in
> the remainder of the call sites, where no attempt was made to use an
> already-available repository pointer that might, or might not, be the
> correct one.

My strategy has always been "use the right repo if available, fall
back to the_repo otherwise". This code path has struct repo, my
mistake was not realize soon enough that there are two repos, not once
(Ironically I made the conversion to add subrepo here).

> It strikes me as a pretty important goal of this patch series to _not_
> change any behavior, and this bug makes me dubious that all diligence has
> been done to assure that.

Sooner or later all the_repo must be converted, what makes _this_
series different from other conversion series? Yes I slipped, I should
have been more careful to the parts related to submodule.
-- 
Duy




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux