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

Re: [PATCH 2/2] Handle invalid argc gently

From
Dmitry V. Levin <ldv@altlinux.org>
Date
Sep 14, 2006, 18:25 UTC
Message-ID
<20060914182539.GA12109@basalt.office.altlinux.org>
In-Reply-To
<7virjq4cfj.fsf@assigned-by-dhcp.cox.net>

On Thu, Sep 14, 2006 at 09:53:36AM -0700, Junio C Hamano wrote: [...]

Show 10 quoted lines
> >> What is the valid reason to do execlp("git", NULL, NULL)?
> >
> > Personally I do not plan to execute git this way on regular basis, indeed. :)
> >
> > But argc == 0 is allowed, so why should git crash?
> 
> Oh, no I was not arguing for making git crash.  I was just
> trying to learn if there is a valid reason to choose to, or
> common misconfiguration that causes it to, run with ac == 0,
> since I did not think of any.

Well, the execlp example is somewhat dragged in. More common case is execvp:

char *argv[] = { NULL }; execvp("git", argv);

The argv array may be empty for various reasons, e.g. pointer arithmetic mistakes.

-- 
ldv
Previous: Junio C Hamano
Message 7 of 7 in “Handle invalid argc gently”
  1. 2/2 Handle invalid argc gentlyDmitry V. Levin, Sep 14, 2006
  2. Junio C HamanoSep 14, 2006
  3. Dmitry V. LevinSep 14, 2006
  4. Junio C HamanoSep 14, 2006
  5. Dmitry V. LevinSep 14, 2006
  6. Junio C HamanoSep 14, 2006
  7. Dmitry V. LevinSep 14, 2006

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.