From: Ben Boeckel <mathstuf@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Junio C Hamano <gitster@pobox.com>, Git List <git@vger.kernel.org>
Subject: Re: [PATCH v2] remote: add get-url subcommand
Date: Mon, 3 Aug 2015 20:16:31 -0400 [thread overview]
Message-ID: <20150804001631.GA10416@megas.kitware.com> (raw)
In-Reply-To: <CAPig+cQO_jXZmJG=EccwQ408TiAk7_BiQF1UKA31phXF7CXy6w@mail.gmail.com>
On Mon, Aug 03, 2015 at 19:38:15 -0400, Eric Sunshine wrote:
> On Mon, Aug 3, 2015 at 5:00 PM, Ben Boeckel <mathstuf@gmail.com> wrote:
> > + OPT_BOOL('\0', "push", &push_mode,
> > + N_("query push URLs")),
>
> A bit more explanatory:
>
> "query push URLs rather than fetch URLs"
Fixed.
> > + OPT_BOOL('\0', "all", &all_mode,
> > + N_("return all URLs")),
> > + OPT_END()
> > + };
> > + argc = parse_options(argc, argv, NULL, options, builtin_remote_geturl_usage,
> > + PARSE_OPT_KEEP_ARGV0);
>
> What is the reason for PARSE_OPT_KEEP_ARGV0 in this case?
Copied from get-url; I presume for more natural argv[] usage within the
function.
> > + if (argc < 1 || argc > 2)
> > + usage_with_options(builtin_remote_geturl_usage, options);
>
> So, 'argc' must be 1 or 2, which in 'argv' terms is argv[0] and argv[1]).
…
> > + remotename = argv[1];
>
> But here, argv[1] is accessed unconditionally, even though 'argc' may
> have been 1, thus out of bounds.
Yep, should be (argc < 2 || argc > 2) (or 1 if PARSE_OPT_KEEP_ARGV0 is
removed). Off-by-one when converting from get-url.
I'll reroll tomorrow morning in case there are more comments until then
(particularly about PARSE_OPT_KEEP_ARGV0).
Thanks,
--Ben
next prev parent reply other threads:[~2015-08-04 0:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 17:38 [PATCH] add ls-remote --get-push-url option Ben Boeckel
2015-07-31 17:38 ` [PATCH] ls-remote: add " Ben Boeckel
2015-07-31 18:40 ` [PATCH] add ls-remote " Junio C Hamano
2015-07-31 18:56 ` Ben Boeckel
2015-07-31 19:02 ` Junio C Hamano
2015-07-31 19:04 ` Ben Boeckel
2015-07-31 19:16 ` Junio C Hamano
2015-07-31 20:51 ` Ben Boeckel
2015-08-03 21:00 ` [PATCH v2] add git-url subcommand Ben Boeckel
2015-08-03 21:00 ` [PATCH v2] remote: add get-url subcommand Ben Boeckel
2015-08-03 23:38 ` Eric Sunshine
2015-08-04 0:16 ` Ben Boeckel [this message]
2015-08-04 0:45 ` Eric Sunshine
2015-08-04 14:56 ` [PATCH v3] " Ben Boeckel
2015-08-05 20:34 ` Junio C Hamano
2015-08-05 21:33 ` Ben Boeckel
2015-08-05 21:39 ` Junio C Hamano
2015-09-04 14:30 ` [PATCH v4] " Ben Boeckel
2015-09-04 22:40 ` Junio C Hamano
2015-09-16 1:53 ` [PATCH v5] " Ben Boeckel
2015-09-16 22:51 ` Junio C Hamano
2015-09-17 0:19 ` [PATCH v6] " Ben Boeckel
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=20150804001631.GA10416@megas.kitware.com \
--to=mathstuf@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sunshine@sunshineco.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 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.