Skip to content

Drop dependency on posix-spawn#21

Merged
ianks merged 1 commit intomainfrom
drop-posix-spawn
Mar 19, 2024
Merged

Drop dependency on posix-spawn#21
ianks merged 1 commit intomainfrom
drop-posix-spawn

Conversation

@casperisfine
Copy link

@casperisfine casperisfine commented Mar 19, 2024

Ref: rtomayko/posix-spawn#93

This gem no longer build on the latest clang version:

posix-spawn.c:226:27: error: incompatible function pointer types passing 'int (VALUE, VALUE, posix_spawn_file_actions_t *)' (aka 'int (unsigned long, unsigned long, void **)') to parameter of type 'int
(*)(VALUE, VALUE, VALUE)' (aka 'int (*)(unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
        rb_hash_foreach(options, posixspawn_file_actions_operations_iter, (VALUE)fops);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/rubies/3.4-dev-03-19/include/ruby-3.4.0+0/ruby/internal/intern/hash.h:83:40: note: passing argument to parameter 'func' here
void rb_hash_foreach(VALUE hash, int (*func)(VALUE key, VALUE val, VALUE arg), VALUE arg);

It's also unnecessary given Ruby's Process.spawn use vfork(2) so it's essentially the same as posix-spawn. The only difference is that Ruby fallback to using fork(2) when running as root, but that's not something that should be common. Other than that there is no perf gain to use posix-spawn gem.

This gem no longer build on the latest clang version:

```
posix-spawn.c:226:27: error: incompatible function pointer types passing 'int (VALUE, VALUE, posix_spawn_file_actions_t *)' (aka 'int (unsigned long, unsigned long, void **)') to parameter of type 'int
(*)(VALUE, VALUE, VALUE)' (aka 'int (*)(unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
        rb_hash_foreach(options, posixspawn_file_actions_operations_iter, (VALUE)fops);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/rubies/3.4-dev-03-19/include/ruby-3.4.0+0/ruby/internal/intern/hash.h:83:40: note: passing argument to parameter 'func' here
void rb_hash_foreach(VALUE hash, int (*func)(VALUE key, VALUE val, VALUE arg), VALUE arg);
```

It's also unnecessary given Ruby's `Process.spawn` use `vfork(2)` so
it's essentially the same as `posix-spawn`. The only difference is that
Ruby fallback to using `fork(2)` when running as root, but that's not something
that should be common. Other than that there is no perf gain to use `posix-spawn` gem.
@casperisfine casperisfine requested a review from ianks March 19, 2024 15:20
@ianks ianks merged commit 3f4c629 into main Mar 19, 2024
@ianks ianks deleted the drop-posix-spawn branch March 19, 2024 15:25
@ianks
Copy link
Contributor

ianks commented Mar 19, 2024

I'll handle the version bump now

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

Successfully merging this pull request may close these issues.

3 participants