janestreet / janestreet/spawn

MacOS Monterey deprecated vfork system call

Open
#34 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
69
Forks
21
PR merge metrics
No merged PRs in 30d

Description

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`.

Contributor guide

Open the contributing guide

Research direction

Start with spawn_stubs.c around line 491, where vfork is selected, and review the related process-spawning path in src/spawn.ml. Run dune build @runtest and inspect test/tests.ml around line 147; done means the Monterey deprecation warning is addressed and the relevant test behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, macos
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.