All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jacob Stopak <jacob@initialcommit.io>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v3 1/1] bugreport: include +i in outfile suffix as needed
Date: Mon, 16 Oct 2023 15:55:50 -0700	[thread overview]
Message-ID: <xmqq4jiqkwi1.fsf@gitster.g> (raw)
In-Reply-To: <20231016214045.146862-2-jacob@initialcommit.io> (Jacob Stopak's message of "Mon, 16 Oct 2023 14:40:45 -0700")

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.

> -	/* 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 ;-).

  reply	other threads:[~2023-10-16 22:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-14  4:01 [PATCH] bugreport: add 'seconds' to default outfile name Jacob Stopak
2023-10-14 10:35 ` Kristoffer Haugsbakk
2023-10-14 16:27 ` Junio C Hamano
2023-10-14 16:33   ` Dragan Simic
2023-10-14 17:45     ` Junio C Hamano
2023-10-14 17:52       ` Dragan Simic
2023-10-15  3:07         ` Jacob Stopak
2023-10-15  3:13           ` Dragan Simic
2023-10-15  3:01   ` Jacob Stopak
2023-10-15 17:06     ` Junio C Hamano
2023-10-15  3:42 ` [PATCH v2 0/3] bugreport: include +i in outfile suffix as needed Jacob Stopak
2023-10-15  3:42   ` [PATCH v2 1/3] " Jacob Stopak
2023-10-15 17:36     ` Junio C Hamano
2023-10-16 21:40     ` [PATCH v3 0/1] " Jacob Stopak
2023-10-16 21:40       ` [PATCH v3 1/1] " Jacob Stopak
2023-10-16 22:55         ` Junio C Hamano [this message]
2023-10-17  3:17           ` Jacob Stopak
2023-10-21  0:39         ` Junio C Hamano
2023-10-26 21:19         ` Emily Shaffer
2023-10-27  6:34           ` Jacob Stopak
2024-01-06  4:54             ` Jacob Stopak
2023-10-15  3:42   ` [PATCH v2 2/3] bugreport: match diagnostics filename with report Jacob Stopak
2023-10-15  3:42   ` [PATCH v2 3/3] bugreport: don't create --diagnose zip w/o report Jacob Stopak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4jiqkwi1.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jacob@initialcommit.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.