Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS Monterey deprecated vfork system call #34

Open
tmcgilchrist opened this issue May 28, 2022 · 4 comments
Open

MacOS Monterey deprecated vfork system call #34

tmcgilchrist opened this issue May 28, 2022 · 4 comments

Comments

@tmcgilchrist
Copy link

When compiling this package on Monterey 12.4:

spawn_stubs.c:491:33: warning: 'vfork' is deprecated: Use posix_spawn or fork [-Wdeprecated-declarations]
  ret = Bool_val(v_use_vfork) ? vfork() : fork();
                                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:604:1: note: 'vfork' has been explicitly marked deprecated here
__deprecated_msg("Use posix_spawn or fork")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:208:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 warning generated.

then running the tests fails with an unrelated error, /usr/bin/sleep doesn't exist on Monterey.

$ dune build @runtest
File "test/tests.ml", line 147, characters 0-480: sigprocmask threw Unix.Unix_error(Unix.ENOENT, "execve", "/usr/bin/sleep").
  Raised by primitive operation at Spawn.spawn in file "src/spawn.ml" (inlined), line 162, characters 6-16
  Called from Spawn.spawn in file "src/spawn.ml", line 169, characters 2-87
  Called from Spawn_test__Tests.(fun).run in file "test/tests.ml", line 150, characters 16-81
  Called from Spawn_test__Tests.(fun) in file "test/tests.ml", line 157, characters 4-19

FAILED 1 / 9 tests

This package should update to use fork(2) or, ideally, posix_spawn(3) as suggested in man vfork 2.

@tov
Copy link
Contributor

tov commented Jul 18, 2022

Here’s a PR for this issue: #39.

@tov
Copy link
Contributor

tov commented Jul 19, 2022

Having looked into posix_spawn, I think it doesn't quite let us implement our API, because it doesn't provide any mechanism for returning an error from the execve(2) call, nor for distinguishing other post-fork errors.

@aalekseyev
Copy link
Contributor

Another reason we don't use posix_spawn is that it doesn't let you change the current working directory, as far as I know.

@tov
Copy link
Contributor

tov commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants