[DRE-maint] Bug#1075472: ruby-posix-spawn: ftbfs with GCC-14
Philipp Kern
pkern at debian.org
Sat Oct 19 21:56:23 BST 2024
Control: tag -1 + patch
> gcc -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -I. -I/usr/include/x86_64-linux-gnu/ruby-3.1.0 -I/usr/include/ruby-3.1.0/ruby/backward -I/usr/include/ruby-3.1.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=BUILDDIR=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fPIC -Wall -o posix-spawn.o -c posix-spawn.c
> posix-spawn.c: In function ‘posixspawn_file_actions_init’:
> posix-spawn.c:226:34: error: passing argument 2 of ‘rb_hash_foreach’ from incompatible pointer type [-Wincompatible-pointer-types]
> 226 | rb_hash_foreach(options, posixspawn_file_actions_operations_iter, (VALUE)fops);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | |
> | int (*)(VALUE, VALUE, posix_spawn_file_actions_t *) {aka int (*)(long unsigned int, long unsigned int, posix_spawn_file_actions_t *)}
> In file included from /usr/include/ruby-3.1.0/ruby/internal/scan_args.h:37,
> from /usr/include/ruby-3.1.0/ruby/ruby.h:46,
> from /usr/include/ruby-3.1.0/ruby.h:38,
> from posix-spawn.c:14:
> /usr/include/ruby-3.1.0/ruby/internal/intern/hash.h:83:40: note: expected ‘int (*)(VALUE, VALUE, VALUE)’ {aka ‘int (*)(long unsigned int, long unsigned int, long unsigned int)’} but argument is of type ‘int (*)(VALUE, VALUE, posix_spawn_file_actions_t *)’ {aka ‘int (*)(long unsigned int, long unsigned int, posix_spawn_file_actions_t *)’}
> 83 | void rb_hash_foreach(VALUE hash, int (*func)(VALUE key, VALUE val, VALUE arg), VALUE arg);
> | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> make[2]: *** [Makefile:246: posix-spawn.o] Error 1
This patch would fix this issue (curiously rb_foreach_func is not
exported from Ruby's hash.c in a header):
Index: ruby-posix-spawn-0.3.15/ext/posix-spawn.c
===================================================================
--- ruby-posix-spawn-0.3.15.orig/ext/posix-spawn.c
+++ ruby-posix-spawn-0.3.15/ext/posix-spawn.c
@@ -212,6 +212,8 @@ posixspawn_file_actions_operations_iter(
return ST_CONTINUE;
}
+typedef int rb_foreach_func(VALUE, VALUE, VALUE);
+
/*
* Initialize the posix_spawn_file_actions_t structure and add operations from
* the options hash. Keys in the options Hash that are processed by handlers are
@@ -223,7 +225,7 @@ static void
posixspawn_file_actions_init(posix_spawn_file_actions_t *fops, VALUE options)
{
posix_spawn_file_actions_init(fops);
- rb_hash_foreach(options, posixspawn_file_actions_operations_iter, (VALUE)fops);
+ rb_hash_foreach(options, (rb_foreach_func*)posixspawn_file_actions_operations_iter, (VALUE)fops);
}
/*
The prototype of posixspawn_file_actions_operations_iter is VALUE,
VALUE, posix_spawn_file_actions_t*. Of course this also expects that
the pointer fits into VALUE. But presumably that's not the first
module with that assumption.
Kind regards
Philipp Kern
More information about the Pkg-ruby-extras-maintainers
mailing list