tech-pkg archive

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

Re: Fix pkg_install on macOS Monterey



* On 2021年11月03日 at 14:16 GMT, Joerg Sonnenberger wrote:
On Wed, Nov 03, 2021 at 12:28:39PM +0000, Jonathan Perkin wrote:
* On 2021年11月03日 at 11:49 GMT, David Brownlee wrote:
> Dumb question - could posix_spawn be used (and does it exhibit the same issue)?
Yeh it could, I discounted it as it has the same problems as system() (the
chdir() is being performed in the parent process), and I'm not convinced
it's very portable, but I could be wrong.
I added that implementation as a comment here:
 https://gist.github.com/jperkin/6e66a8753ec8039b298cac7b57f2a7de#gistcomment-3949644
Try something like:
 int old_cwd = open(".", O_RDONLY|O_CLOEXEC|O_DIRECTORY);
 chdir(path);
 posix_spawn(...);
 fchdir(old_cwd);
Modulo error checking and defining O_CLOEXEC/O_DIRECTORY to 0 if they
don't exist.
Ok, how about this one:
 https://gist.github.com/jperkin/ae32d3464e3a2d261945608f80d8b8c1
I went back and looked through the xnu history and it looks like posix_spawn was added in 10.5, or at least around then (xnu-1228), so I'd be happy to turn this on for __APPLE__ as even trying to support 10.6 a few years back was a miserable experience.
--
Jonathan Perkin - Joyent, Inc. - www.joyent.com


Home | Main Index | Thread Index | Old Index

AltStyle によって変換されたページ (->オリジナル) /