From: Patrick Steinhardt <ps@pks.im>
To: emilylime via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, emilylime <emilyyyylime+git@gmail.com>
Subject: Re: [PATCH] archive: error instead of triggering a segfault in `git archive --remote=""`
Date: Mon, 10 Mar 2025 08:37:25 +0100 [thread overview]
Message-ID: <Z86WtQ-3Rk9OSmn_@pks.im> (raw)
In-Reply-To: <pull.1877.git.1741515155475.gitgitgadget@gmail.com>
On Sun, Mar 09, 2025 at 10:12:35AM +0000, emilylime via GitGitGadget wrote:
> From: emilylime <emilyyyylime+git@gmail.com>
This is missing a bit of a description:
- What is the observed bug?
- When does the bug trigger?
- Optional: since when does the bug exist?
- How do we fix it?
- Optional: are there alternative ways to fix this bug that you have
considered but found to be less optimal.
> Signed-off-by: emilylime <emilyyyylime+git@gmail.com>
We usually prefer people to sign off with their full name.
> diff --git a/builtin/archive.c b/builtin/archive.c
> index 13ea7308c8b..b6fdbfc7dca 100644
> --- a/builtin/archive.c
> +++ b/builtin/archive.c
> @@ -97,6 +97,10 @@ int cmd_archive(int argc,
> argc = parse_options(argc, argv, prefix, local_opts, NULL,
> PARSE_OPT_KEEP_ALL);
>
> + if (remote && !remote[0]) {
Okay, so this triggers in case the user passes "--remote ''"?
I see that we ultimately pass the string to `remote_get()`, so does that
function segfault? If so, can other callers of that function segfault in
a similar way? In that case, we should probably address the issue deeper
down in the call stack.
> + usage(N_("Option 'remote' may not be left empty"));
Error and usage strings should start with a lower-case letter.
> + }
The curly braces aren't required.
It would also be nice to add a testcase, e.g. in "t/t5000-tar-tree.sh".
Thanks!
Patrick
next prev parent reply other threads:[~2025-03-10 7:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-09 10:12 [PATCH] archive: error instead of triggering a segfault in `git archive --remote=""` emilylime via GitGitGadget
2025-03-10 7:37 ` Patrick Steinhardt [this message]
2025-03-10 15:59 ` Junio C Hamano
2025-03-10 11:25 ` Junio C Hamano
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=Z86WtQ-3Rk9OSmn_@pks.im \
--to=ps@pks.im \
--cc=emilyyyylime+git@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).