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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Aug 25, 2010, at 11:18 PM, Jonathan Nieder wrote:

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


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]