From: Pierre Habouzit <madcoder@madism.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Stephen Boyd <bebarino@gmail.com>,
git@vger.kernel.org, Pierre Habouzit <madcoder@debian.org>
Subject: Re: [PATCH] show-branch: fix segfault when showbranch.default exists
Date: Tue, 9 Jun 2009 19:23:02 +0200 [thread overview]
Message-ID: <20090609172302.GH9993@laphroaig.corp> (raw)
In-Reply-To: <7viqj5nzgz.fsf@alter.siamese.dyndns.org>
On Tue, Jun 09, 2009 at 09:28:28AM -0700, Junio C Hamano wrote:
> Pierre Habouzit <madcoder@madism.org> writes:
>
> > On Tue, Jun 09, 2009 at 12:17:28AM -0700, Stephen Boyd wrote:
> >> Junio C Hamano wrote:
> >> > I am not sure if this is a bug in parse_options(), or a bug in the caller,
> >> > and tonight I do not have enough concentration to figure out which. In
> >> > any case, this patch works the issue around.
> >>
> >> I am low on concentration tonight as well, but this looks right to me.
> >> Parse options is expecting the regular old argv and argc. I overlooked
> >> this code path during the conversion (though I remember figuring out
> >> what this path was doing). Faking the argv and argc a little more
> >> accurately, like you do, should work fine.
> >
> > yes, that's it.
>
> Wait a minute, please.
>
> Why is parse_options() allowed to clobber argv[0] in parse_options_end()
> in the first place?
>
> I think the memmove() is there to allow the caller to find the remaining
> arguments after the library parsed out the options in argv[], but wouldn't
> the caller be expecting to inspect argv[] starting from position 1?
>
> In other words, anything moved to the position of original argv[0] would
> be lost, and the problem I stumbled upon was exactly that (it triggered
> because the location of argv[0] was invalid and parse_options_end() wrote
> into it).
it does because it supposes that the command is there, and that when I
ported the old parsing stuff it's what it was doing.
FWIW I believe it's a misfeature.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
next prev parent reply other threads:[~2009-06-09 17:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 6:26 [PATCH] show-branch: fix segfault when showbranch.default exists Junio C Hamano
2009-06-09 7:17 ` Stephen Boyd
2009-06-09 8:06 ` Pierre Habouzit
2009-06-09 16:28 ` Junio C Hamano
2009-06-09 17:23 ` Pierre Habouzit [this message]
2009-06-09 17:35 ` branch management Harry Duin
2009-06-09 19:50 ` Alex Riesen
2009-06-10 14:02 ` Harry Duin
2009-06-10 14:43 ` Jakub Narebski
2009-06-10 15:28 ` Nicolas Pitre
2009-06-10 17:37 ` Linus Torvalds
2009-06-10 19:14 ` Daniel Barkalow
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=20090609172302.GH9993@laphroaig.corp \
--to=madcoder@madism.org \
--cc=bebarino@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=madcoder@debian.org \
/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).