git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Fwd: [PATCH v2 09/11] bisect: libify `check_good_are_ancestors_of_bad` and its dependents

From
Miriam R. <mirucam@gmail.com>
Date
Jan 31, 2020, 10:21 UTC
Message-ID
<CAN7CjDD2rDKT6Ngg7Mfo4oDB5vxCGqhx-w5aGfC-f_thNMBKmQ@mail.gmail.com>
In-Reply-To
<CAN7CjDC7ijMDtJdShRB+P0d0GRYYrQXktdH2Og9XGDqJ-OZxzw@mail.gmail.com>
Hi,

El vie., 31 ene. 2020 a las 10:15, Christian Couder (<christian.couder@gmail.com>) escribió:

Show 54 quoted lines
>
> Hi Dscho,
>
> On Fri, Jan 31, 2020 at 10:07 AM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> >
> > On Thu, 30 Jan 2020, Christian Couder wrote:
> >
> > > On Thu, Jan 30, 2020 at 2:46 PM Johannes Schindelin
> > > <Johannes.Schindelin@gmx.de> wrote:
> > > >
> > > > On Tue, 28 Jan 2020, Miriam Rubio wrote:
> > >
> > > > > +             /* Create file BISECT_ANCESTORS_OK. */
> > > > > +             fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0600);
> > > > > +             if (fd < 0)
> > > > > +                     warning_errno(_("could not create file '%s'"),
> > > > > +                                   filename);
> > > > > +             else
> > > > > +                     close(fd);
> > > > > +     }
> > > >
> > > > I wonder whether this would be easier to read:
> > > >
> > > >         if (res == -11)
> > > >                 res = 0;
> > > >         else if (res)
> > > >                 ; /* error out */
> > > >         else if ((fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0600)) < 0)
> > > >                 res = warning_errno(_("could not create file '%s'"), filename);
> > > >         else
> > > >                 close(fd);
> > > >
> > > > Note: my code explicitly assigns `res = -1` if the file could not be
> > > > created, which is technically a change in behavior, but I think it is
> > > > actually a bug fix.
> > >
> > > I don't think so. I think creating the BISECT_ANCESTORS_OK file is not
> > > absolutely necessary. If it doesn't exist we will just check if
> > > ancestors are ok again at the next bisection step, which will take a
> > > bit of time, but which will not make us give any false result, or
> > > prevent us from continuing the bisection process.
> > >
> > > I think that it's also the reason why warning_errno(...) is used in
> > > case we could not create the file instead of error_errno(...). We just
> > > want to signal with a warning that something might be wrong because we
> > > could not create the file, but not stop everything because of that.
> >
> > Thank you for this explanation, it makes sense to me.
> >
> > Maybe a code comment would be in order?
>
> Yeah, I agree it would help.
>

Noted. Thank you both for the review!

Best, Miriam

> Thanks for your review,
> Christian.
Previous: Miriam R.
Message 29 of 29 in “Finish converting git bisect to C part 1”
  1. Miriam RubioJan 28, 2020
  2. 01/11 bisect--helper: convert `vocab_*` char pointers to char arraysMiriam Rubio, Jan 28, 2020
  3. 02/11 bisect--helper: change `retval` to `res`Miriam Rubio, Jan 28, 2020
  4. 03/11 bisect: use the standard 'if (!var)' way to check for 0Miriam Rubio, Jan 28, 2020
  5. 04/11 run-command: make `exists_in_PATH()` non-staticMiriam Rubio, Jan 28, 2020
  6. Johannes SchindelinJan 30, 2020
  7. 05/11 bisect--helper: introduce new `decide_next()` functionMiriam Rubio, Jan 28, 2020
  8. Johannes SchindelinJan 30, 2020
  9. Miriam R.Jan 30, 2020
  10. 06/11 bisect: libify `exit_if_skipped_commits` to `error_if_skipped*` and its dependentsMiriam Rubio, Jan 28, 2020
  11. Junio C HamanoJan 31, 2020
  12. 07/11 bisect: libify `bisect_checkout`Miriam Rubio, Jan 28, 2020
  13. Junio C HamanoJan 31, 2020
  14. 08/11 bisect: libify `check_merge_bases` and its dependentsMiriam Rubio, Jan 28, 2020
  15. Junio C HamanoJan 31, 2020
  16. 11/11 bisect: libify `bisect_next_all`Miriam Rubio, Jan 28, 2020
  17. 10/11 bisect: libify `handle_bad_merge_base` and its dependentsMiriam Rubio, Jan 28, 2020
  18. 09/11 bisect: libify `check_good_are_ancestors_of_bad` and its dependentsMiriam Rubio, Jan 28, 2020
  19. Johannes SchindelinJan 30, 2020
  20. Miriam R.Jan 30, 2020
  21. Johannes SchindelinJan 30, 2020
  22. Miriam R.Jan 30, 2020
  23. Christian CouderJan 30, 2020
  24. Johannes SchindelinJan 31, 2020
  25. Christian CouderJan 31, 2020
  26. Johannes SchindelinJan 30, 2020
  27. Miriam R.Jan 30, 2020
  28. Fwd: [PATCH v2 04/11] run-command: make `exists_in_PATH()` non-staticMiriam R., Jan 30, 2020
  29. Fwd: [PATCH v2 09/11] bisect: libify `check_good_are_ancestors_of_bad` and its dependentsMiriam R., Jan 31, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.