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

Re: [PATCH v3 1/1] bugreport: include +i in outfile suffix as needed

From
Jacob Stopak <jacob@initialcommit.io>
Date
Oct 17, 2023, 03:17 UTC
Message-ID
<ZS38ykTuqHXYnU57.jacob@initialcommit.io>
In-Reply-To
<xmqq4jiqkwi1.fsf@gitster.g>
On Mon, Oct 16, 2023 at 03:55:50PM -0700, Junio C Hamano wrote:
Show 10 quoted lines
> Jacob Stopak <jacob@initialcommit.io> writes:
> 
> >  builtin/bugreport.c | 83 +++++++++++++++++++++++++++++++--------------
> >  1 file changed, 57 insertions(+), 26 deletions(-)
> 
> Looking good.  It is not easy to do an automated and reliable test
> for this one for obvious reasons ;-), so let's queue it as-is.
> 
> Thanks.
> 
Awesome! Thank you!
Show 16 quoted lines
> > -	/* fopen doesn't offer us an O_EXCL alternative, except with glibc. */
> > -	report = xopen(report_path.buf, O_CREAT | O_EXCL | O_WRONLY, 0666);
> > +	again:
> > +		/* fopen doesn't offer us an O_EXCL alternative, except with glibc. */
> > +		report = open(report_path.buf, O_CREAT | O_EXCL | O_WRONLY, 0666);
> > +		if (report < 0 && errno == EEXIST && !option_suffix_is_from_user) {
> > +			build_path(&report_path, prefixed_filename,
> > +				   "git-bugreport-", option_suffix, now, &i,
> > +				   ".txt");
> > +			goto again;
> > +		} else if (report < 0) {
> > +			die_errno(_("unable to open '%s'"), report_path.buf);
> > +		}
> 
> I didn't expect a rewrite to add an extra level of indentation like
> this, though ;-).

Whoops... I looked in another file to check the indentation around a goto label and misread how it should be. Let me know if I should submit v4 with that corrected.

Previous: Junio C HamanoNext: Junio C Hamano
Message 17 of 23 in “bugreport: add 'seconds' to default outfile name”
  1. bugreport: add 'seconds' to default outfile nameJacob Stopak, Oct 14, 2023
  2. Kristoffer HaugsbakkOct 14, 2023
  3. Junio C HamanoOct 14, 2023
  4. Dragan SimicOct 14, 2023
  5. Junio C HamanoOct 14, 2023
  6. Dragan SimicOct 14, 2023
  7. Jacob StopakOct 15, 2023
  8. Dragan SimicOct 15, 2023
  9. Jacob StopakOct 15, 2023
  10. Junio C HamanoOct 15, 2023
  11. 0/3 bugreport: include +i in outfile suffix as neededJacob Stopak, Oct 15, 2023
  12. 1/3 bugreport: include +i in outfile suffix as neededJacob Stopak, Oct 15, 2023
  13. Junio C HamanoOct 15, 2023
  14. 0/1 bugreport: include +i in outfile suffix as neededJacob Stopak, Oct 16, 2023
  15. 1/1 bugreport: include +i in outfile suffix as neededJacob Stopak, Oct 16, 2023
  16. Junio C HamanoOct 16, 2023
  17. Jacob StopakOct 17, 2023
  18. Junio C HamanoOct 21, 2023
  19. Emily ShafferOct 26, 2023
  20. Jacob StopakOct 27, 2023
  21. Jacob StopakJan 6, 2024
  22. 2/3 bugreport: match diagnostics filename with reportJacob Stopak, Oct 15, 2023
  23. 3/3 bugreport: don't create --diagnose zip w/o reportJacob Stopak, Oct 15, 2023

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.