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

Re: setting working dir in posix_spawn() (Re: Fix 'git log' early pager startup error case)

From
JJJoshua Juran <jjuran@gmail.com>
Date
Aug 26, 2010, 07:16 UTC
Message-ID
<65AAB642-0AEB-40F3-8C33-81AA2C110D3E@gmail.com>
In-Reply-To
<20100826061815.GH9708@burratino>
On Aug 25, 2010, at 11:18 PM, Jonathan Nieder wrote:
Show 16 quoted lines
> Eric Blake wrote:
>> On 08/25/2010 01:00 AM, Johannes Sixt wrote:
>
>>> Just FYI, posix_spawn() is not sufficiently capable for the  
>>> demands of
>>> start_command(): It doesn't allow to set a new CWD for the spawned  
>>> process.
>>
>> And even if posix_spawn() were capable, cygwin doesn't yet  
>> implement it.
>
> Hmm, okay.  You have access to win32api, though, right?  So it should
> be possible to reuse code from compat/mingw.c::mingw_spawnvpe.
>
> Do you think there would be any interest in a posix_spawn() variant
> that takes a dir parameter?

Another option would be a variant of vfork() where munging file descriptors, cwd, etc. prior to exec is well defined. In Lamp (Lamp ain't Mac POSIX), vfork() does this already; in Linux you'd just use fork(). The problem is that currently no common interface exists which guarantees behavior which is both sufficient and cheap -- vfork() promises nothing at all, and fork() is expensive (if available at all) on some platforms, guaranteeing much more than is often needed.

It would be useful to have something in between vfork() and fork(), though I'm not sure what it should be called.

Josh
Previous: Jonathan NiederNext: Eric Blake
Message 6 of 9 in “Fix 'git log' early pager startup error case”
  1. Linus TorvaldsAug 24, 2010
  2. Jonathan NiederAug 25, 2010
  3. Johannes SixtAug 25, 2010
  4. Eric BlakeAug 25, 2010
  5. setting working dir in posix_spawn() (Re: Fix 'git log' early pager startup error case)Jonathan Nieder, Aug 26, 2010
  6. Joshua JuranAug 26, 2010
  7. Eric BlakeAug 26, 2010
  8. Junio C HamanoAug 25, 2010
  9. Linus TorvaldsAug 25, 2010

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.