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

dep: update libxml to 2.12.0 (with explicit -lpthread linkline) #3026

Closed
wants to merge 6 commits into from
Closed
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
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
if: matrix.sys == 'disable'
with:
path: ports
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}}
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch', 'ext/nokogiri/extconf.rb')}}
- run: bundle install --local || bundle install
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
if: matrix.sys == 'disable'
with:
path: ports
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}}
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch', 'ext/nokogiri/extconf.rb')}}
- run: bundle install --local || bundle install
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test:valgrind
Expand All @@ -151,7 +151,7 @@ jobs:
strategy:
fail-fast: false
matrix:
sys: ["enable"]
sys: ["enable", "disable"]
runs-on: ubuntu-latest
container:
image: ghcr.io/sparklemotion/nokogiri-test:alpine
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:
if: matrix.sys == 'disable'
with:
path: ports
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}}
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch', 'ext/nokogiri/extconf.rb')}}
- run: bundle install --local || bundle install
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test
Expand All @@ -227,7 +227,7 @@ jobs:
if: matrix.sys == 'disable'
with:
path: ports
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}}
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch', 'ext/nokogiri/extconf.rb')}}
- run: bundle install --local || bundle install
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test:valgrind
Expand All @@ -253,7 +253,7 @@ jobs:
if: matrix.sys == 'disable'
with:
path: ports
key: ports-macos-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}}
key: ports-macos-${{hashFiles('dependencies.yml', 'patches/**/*.patch', 'ext/nokogiri/extconf.rb')}}
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test

Expand Down Expand Up @@ -283,7 +283,7 @@ jobs:
if: matrix.sys == 'disable'
with:
path: ports
key: ports-windows-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}}
key: ports-windows-${{hashFiles('dependencies.yml', 'patches/**/*.patch', 'ext/nokogiri/extconf.rb')}}
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test

Expand Down Expand Up @@ -378,7 +378,7 @@ jobs:
if: matrix.sys == 'disable'
with:
path: ports
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}}
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch', 'ext/nokogiri/extconf.rb')}}
- run: bundle install --local || bundle install
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test:memcheck
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- uses: actions/cache@v3
with:
path: ports
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}}
key: ports-ubuntu-${{matrix.ruby}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch', 'ext/nokogiri/extconf.rb')}}
- if: matrix.precommand
run: ${{matrix.precommand}}
- run: gem install bundler -v ">= 2.3.22" # for "add --path"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
if: matrix.sys == 'disable'
with:
path: ports
key: ports-${{matrix.plat}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}}
key: ports-${{matrix.plat}}-${{hashFiles('dependencies.yml', 'patches/**/*.patch', 'ext/nokogiri/extconf.rb')}}
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test

Expand All @@ -142,7 +142,7 @@ jobs:
if: matrix.sys == 'disable'
with:
path: ports
key: ports-ubuntu-head-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}}
key: ports-ubuntu-head-${{hashFiles('dependencies.yml', 'patches/**/*.patch', 'ext/nokogiri/extconf.rb')}}
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test:valgrind
- run: bundle exec rake test:memcheck
Expand Down Expand Up @@ -172,7 +172,7 @@ jobs:
- uses: actions/cache@v3
with:
path: ports
key: ports-ubuntu-3.2-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}}
key: ports-ubuntu-3.2-${{hashFiles('dependencies.yml', 'patches/**/*.patch', 'ext/nokogiri/extconf.rb')}}
- name: Update html5lib-tests
run: |
cd test/html5lib-tests
Expand Down
12 changes: 6 additions & 6 deletions dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
libxml2:
version: "2.11.5"
sha256: "3727b078c360ec69fa869de14bd6f75d7ee8d36987b071e6928d4720a28df3a6"
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.5.sha256sum
version: "2.12.0"
sha256: "431521c8e19ca396af4fa97743b5a6bfcccddbba90e16426a15e5374cd64fe0d"
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.12/libxml2-2.12.0.sha256sum

libxslt:
version: "1.1.38"
sha256: "1f32450425819a09acaff2ab7a5a7f8a2ec7956e505d7beeb45e843d0e1ecab1"
# sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.38.sha256sum
version: "1.1.39"
sha256: "2a20ad621148339b0759c4d4e96719362dee64c9a096dbba625ba053846349f0"
# sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.39.sha256sum

zlib:
version: "1.3"
Expand Down
8 changes: 8 additions & 0 deletions ext/nokogiri/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@ def configure

cppflags = concat_flags(ENV["CPPFLAGS"])
cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
libs = ""

if cross_build_p
cppflags = concat_flags(cppflags, "-DNOKOGIRI_PRECOMPILED_LIBRARIES")
Expand Down Expand Up @@ -913,6 +914,12 @@ def configure
"--disable-dependency-tracking"
end

# glibc 2.34 and later merged libpthread into libc, but we still need to know if it exists so we
# can link libxml2 against it.
if local_have_library("pthread", "pthread_key_delete")
libs = concat_flags(libs, "-lpthread")
end

recipe.configure_options += [
"--without-python",
"--without-readline",
Expand All @@ -921,6 +928,7 @@ def configure
"--with-threads",
"CPPFLAGS=#{cppflags}",
"CFLAGS=#{cflags}",
"LIBS=#{libs}",
]
end

Expand Down
2 changes: 1 addition & 1 deletion ext/nokogiri/html4_sax_push_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ native_write(VALUE self, VALUE _chunk, VALUE _last_chunk)

if ((status != 0) && !(ctx->options & XML_PARSE_RECOVER)) {
// TODO: there appear to be no tests for this block
xmlErrorPtr e = xmlCtxtGetLastError(ctx);
xmlErrorConstPtr e = xmlCtxtGetLastError(ctx);
Nokogiri_error_raise(NULL, e);
}

Expand Down
9 changes: 6 additions & 3 deletions ext/nokogiri/nokogiri.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ xmlNodePtr xmlLastElementChild(xmlNodePtr parent);
#define XMLNS_PREFIX "xmlns"
#define XMLNS_PREFIX_LEN 6 /* including either colon or \0 */

#ifndef xmlErrorConstPtr
# define xmlErrorConstPtr const xmlError *
#endif

#include <ruby.h>
#include <ruby/st.h>
Expand Down Expand Up @@ -227,9 +230,9 @@ void Nokogiri_structured_error_func_save(libxmlStructuredErrorHandlerState *hand
void Nokogiri_structured_error_func_save_and_set(libxmlStructuredErrorHandlerState *handler_state, void *user_data,
xmlStructuredErrorFunc handler);
void Nokogiri_structured_error_func_restore(libxmlStructuredErrorHandlerState *handler_state);
VALUE Nokogiri_wrap_xml_syntax_error(xmlErrorPtr error);
void Nokogiri_error_array_pusher(void *ctx, xmlErrorPtr error);
NORETURN_DECL void Nokogiri_error_raise(void *ctx, xmlErrorPtr error);
VALUE Nokogiri_wrap_xml_syntax_error(xmlErrorConstPtr error);
void Nokogiri_error_array_pusher(void *ctx, xmlErrorConstPtr error);
NORETURN_DECL void Nokogiri_error_raise(void *ctx, xmlErrorConstPtr error);
void Nokogiri_marshal_xpath_funcall_and_return_values(xmlXPathParserContextPtr ctx, int nargs, VALUE handler,
const char *function_name) ;

Expand Down
2 changes: 1 addition & 1 deletion ext/nokogiri/test_global_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
static VALUE foreign_error_handler_block = Qnil;

static void
foreign_error_handler(void *user_data, xmlErrorPtr c_error)
foreign_error_handler(void *user_data, xmlErrorConstPtr c_error)
{
rb_funcall(foreign_error_handler_block, rb_intern("call"), 0);
}
Expand Down
6 changes: 3 additions & 3 deletions ext/nokogiri/xml_document.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ read_io(VALUE klass,
xmlSetStructuredErrorFunc(NULL, NULL);

if (doc == NULL) {
xmlErrorPtr error;
xmlErrorConstPtr error;

xmlFreeDoc(doc);

Expand Down Expand Up @@ -383,7 +383,7 @@ read_memory(VALUE klass,
xmlSetStructuredErrorFunc(NULL, NULL);

if (doc == NULL) {
xmlErrorPtr error;
xmlErrorConstPtr error;

xmlFreeDoc(doc);

Expand Down Expand Up @@ -537,7 +537,7 @@ create_entity(int argc, VALUE *argv, VALUE self)
);

if (NULL == ptr) {
xmlErrorPtr error = xmlGetLastError();
xmlErrorConstPtr error = xmlGetLastError();
if (error) {
rb_exc_raise(Nokogiri_wrap_xml_syntax_error(error));
} else {
Expand Down
2 changes: 1 addition & 1 deletion ext/nokogiri/xml_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -2138,7 +2138,7 @@ process_xincludes(VALUE self, VALUE options)
xmlSetStructuredErrorFunc(NULL, NULL);

if (rcode < 0) {
xmlErrorPtr error;
xmlErrorConstPtr error;

error = xmlGetLastError();
if (error) {
Expand Down
2 changes: 1 addition & 1 deletion ext/nokogiri/xml_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ static VALUE
read_more(VALUE self)
{
xmlTextReaderPtr reader;
xmlErrorPtr error;
xmlErrorConstPtr error;
VALUE error_list;
int ret;

Expand Down
2 changes: 1 addition & 1 deletion ext/nokogiri/xml_relax_ng.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ xml_relax_ng_parse_schema(
xmlRelaxNGFreeParserCtxt(c_parser_context);

if (NULL == c_schema) {
xmlErrorPtr error = xmlGetLastError();
xmlErrorConstPtr error = xmlGetLastError();
if (error) {
Nokogiri_error_raise(NULL, error);
} else {
Expand Down
2 changes: 1 addition & 1 deletion ext/nokogiri/xml_sax_push_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ native_write(VALUE self, VALUE _chunk, VALUE _last_chunk)

if (xmlParseChunk(ctx, chunk, size, Qtrue == _last_chunk ? 1 : 0)) {
if (!(ctx->options & XML_PARSE_RECOVER)) {
xmlErrorPtr e = xmlCtxtGetLastError(ctx);
xmlErrorConstPtr e = xmlCtxtGetLastError(ctx);
Nokogiri_error_raise(NULL, e);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ext/nokogiri/xml_schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ xml_schema_parse_schema(
xmlSchemaFreeParserCtxt(c_parser_context);

if (NULL == c_schema) {
xmlErrorPtr error = xmlGetLastError();
xmlErrorConstPtr error = xmlGetLastError();
if (error) {
Nokogiri_error_raise(NULL, error);
} else {
Expand Down
6 changes: 3 additions & 3 deletions ext/nokogiri/xml_syntax_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ Nokogiri_structured_error_func_restore(libxmlStructuredErrorHandlerState *handle
}

void
Nokogiri_error_array_pusher(void *ctx, xmlErrorPtr error)
Nokogiri_error_array_pusher(void *ctx, xmlErrorConstPtr error)
{
VALUE list = (VALUE)ctx;
Check_Type(list, T_ARRAY);
rb_ary_push(list, Nokogiri_wrap_xml_syntax_error(error));
}

void
Nokogiri_error_raise(void *ctx, xmlErrorPtr error)
Nokogiri_error_raise(void *ctx, xmlErrorConstPtr error)
{
rb_exc_raise(Nokogiri_wrap_xml_syntax_error(error));
}

VALUE
Nokogiri_wrap_xml_syntax_error(xmlErrorPtr error)
Nokogiri_wrap_xml_syntax_error(xmlErrorConstPtr error)
{
VALUE msg, e, klass;

Expand Down

This file was deleted.

21 changes: 11 additions & 10 deletions rakelib/extensions.rake
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ CrossRuby = Struct.new(:version, :platform) do
"ws2_32.dll",
"user32.dll",
"advapi32.dll",
"libwinpthread-1.dll",
libruby_dll,
]
when MINGWUCRT_PLATFORM_REGEX
Expand All @@ -160,25 +161,26 @@ CrossRuby = Struct.new(:version, :platform) do
"api-ms-win-crt-string-l1-1-0.dll",
"api-ms-win-crt-time-l1-1-0.dll",
"api-ms-win-crt-utility-l1-1-0.dll",
"libwinpthread-1.dll",
libruby_dll,
]
when X86_LINUX_PLATFORM_REGEX
[
"libm.so.6",
"libc.so.6",
"libdl.so.2", # on old dists only - now in libc
].tap do |dlls|
dlls << "libpthread.so.0" if ver >= "3.2.0"
end
"libpthread.so.0", # on old dists only - now in libc
"ld-linux.so.2",
"ld-linux-x86-64.so.2",
]
when AARCH_LINUX_PLATFORM_REGEX
[
"libm.so.6",
"libc.so.6",
"libdl.so.2", # on old dists only - now in libc
"libpthread.so.0", # on old dists only - now in libc
"ld-linux-aarch64.so.1",
].tap do |dlls|
dlls << "libpthread.so.0" if ver >= "3.2.0"
end
]
when DARWIN_PLATFORM_REGEX
[
"/usr/lib/libSystem.B.dylib",
Expand All @@ -188,12 +190,11 @@ CrossRuby = Struct.new(:version, :platform) do
when ARM_LINUX_PLATFORM_REGEX
[
"libm.so.6",
"libdl.so.2",
"libc.so.6",
"libdl.so.2", # on old dists only - now in libc
"libpthread.so.0", # on old dists only - now in libc
"ld-linux-armhf.so.3",
].tap do |dlls|
dlls << "libpthread.so.0" if ver >= "3.2.0"
end
]
else
raise "CrossRuby.allowed_dlls: unmatched platform: #{platform}"
end
Expand Down
Loading