Re: [RFC/PATCH] bisect--helper: `bisect_clean_state` shell function in C
- From
Pranit Bauva <pranit.bauva@gmail.com>
- Date
- May 31, 2016, 06:33 UTC
- Message-ID
- <CAFZEwPOhGuTkZcP+hmnCrNjvHGM_FKUOsQaGwWKoUzokCN5OFg@mail.gmail.com>
- In-Reply-To
- <CAP8UFD2wAKN2CsfndLNeCb1dAEH5H-wj_6spAm+d_AtBQDZfhQ@mail.gmail.com>
Hey Christian,
On Tue, May 31, 2016 at 3:18 AM, Christian Couder <christian.couder@gmail.com> wrote:
Show 16 quoted lines
> On Mon, May 30, 2016 at 8:21 PM, Pranit Bauva <pranit.bauva@gmail.com> wrote: >> --- >> This patch contains a bug. I have tried to identify the bug and I suppose it >> exists in do_for_each_entry_in_dir(). I have reproduced the debugging session >> at this link[1]. I have seen that some patches in mailing list regarding >> iterating over refs. Will those affect this? Or is this bug fixed in those >> patches? >> >> [1]: http://paste.ubuntu.com/16830752/ > > The debug session seems to use code source from a previous version of > this patch. > Also it is not cear in which context you run git under gdb. What have > you done before? > And we don't see a crash. Could you show the crash and run the "bt" > command in gdb to get a backtrace?
The segmentation fault will occur if I move to the next step ie. evaluate the value entry->flag.
Show 12 quoted lines
>> @@ -79,11 +90,42 @@ int write_terms(const char *bad, const char *good)
>> strbuf_release(&content);
>> return (res < 0) ? -1 : 0;
>> }
>> +
>> +int remove_bisect_ref(const char *refname, const struct object_id *oid,
>> + int flag, void *cb_data)
>> +{
>> + char *ref;
>> + ref = xstrfmt("refs/bisect/%s", refname);
>
> You could save one line by concatenating the 2 above lines.Sure!
Show 5 quoted lines
>> + if (delete_ref(ref, oid->hash, flag))
>> + return error(_("couldn't delete the ref %s\n"), ref);
>> + return 0;
>
> You need to free "ref".Sure!
Regards, Pranit Bauva