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

(PA-6549) Patch selinux_ruby_wrap.c to fix warning: undefining the allocator of T_DATA class # SWIG::TYPE_p_selabel_handle #864

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions configs/components/_base-ruby-selinux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#

pkg.add_source("file://resources/patches/ruby-selinux/selinuxswig_ruby_wrap.patch")
pkg.add_source("file://resources/patches/ruby-selinux/selinuxswig_ruby_undefining_allocator.patch")
pkg.add_source("file://resources/patches/ruby-selinux/undefining_allocator_el_7.patch")

# These can be overridden by the including component.
ruby_version ||= settings[:ruby_version]
Expand Down Expand Up @@ -81,6 +83,17 @@
unless platform.name =~ /^(debian-12|ubuntu-24|fedora-40)/
steps << "#{platform.patch} --strip=0 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../selinuxswig_ruby_wrap.patch"
end
# EL 7 uses an older version of swig (2.0) so a different patch is needed to
# fix warning:undefining the allocator of T_DATA class
if platform.name =~ /el-7|redhatfips-7/
steps << "#{platform.patch} --strip=0 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../undefining_allocator_el_7.patch"
else
# Ubuntu 24 & Fedora 40 use a newer swig that already has the fix that's
# being patched
unless platform.name =~ /^(ubuntu-24|fedora-40)/
steps << "#{platform.patch} --strip=0 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../selinuxswig_ruby_undefining_allocator.patch"
end
end
end

# libselinux 3.3 is the minimum version we want to build on RHEL 9, but the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- selinuxswig_ruby_wrap.c.orig 2024-06-11 20:02:30.112707265 +0000
+++ selinuxswig_ruby_wrap.c 2024-06-11 22:34:16.000151780 +0000
@@ -1510,7 +1510,7 @@
_cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
}
- rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
+ rb_undef_alloc_func(rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer));
free((void *) klass_name);
}
10 changes: 10 additions & 0 deletions resources/patches/ruby-selinux/undefining_allocator_el_7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- selinuxswig_ruby_wrap_orig.c 2024-06-14 18:03:11.946019756 +0000
+++ selinuxswig_ruby_wrap.c 2024-06-14 18:08:23.057169863 +0000
@@ -1486,7 +1486,7 @@
_cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
}
- klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
+ rb_undef_alloc_func(rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer));
free((void *) klass_name);
}
Loading