nokogiri 1.11.0.rc4 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9921a07571567ba6a57123d7908a809da81890c73206fc180fdd6e376d59d6c8
4
- data.tar.gz: 444e6ab366d0b5abe7914d4f2f8562b1b1cda6d3d4b4ff7ed95173a20c0442eb
3
+ metadata.gz: a800fb24c3e54cee605b4655bfea25d8fecb99d003b4c2cd67be74d22b9602a6
4
+ data.tar.gz: 1d965115bb1db88fc896d34af1372419d97ecde7e84cb2e4f3f0f0c519cab87e
5
5
  SHA512:
6
- metadata.gz: b73282ab01ee491a73c5cb0e28ed73643f1152610f08bd0bc7f5e5358a899b95c0f37c34ea622e9d0fe18927867a07993386516c62f675e0a9de5d307c5d299d
7
- data.tar.gz: df0a5ee23faa5ea65df54af7d927fe8ba1fbc0d630d400f04768cd713f979547cb08d9996a9c6beef58c597f02e6ba647bf07153a13c7df76e19e6c26e9ad22e
6
+ metadata.gz: 1776b8569e5ce07bc8cc21c3cd079418c7e0a002a056a8c3ad1b1c28380e6b878f461be8d2e0134ac853c24ed3601e6ee880f30b8b6f3e6b136acb40583f8326
7
+ data.tar.gz: 9b868c176d1ede0e88ea6feee367652e5cba3b72ab87dddd1e991f0df1c6ffe376e3ad49bd5cc6fd0fbb495b47f333d0e89f4df530f22162835f811178ac82a6
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/README.md CHANGED
@@ -1,21 +1,27 @@
1
+ <div><img src="https://nokogiri.org/images/nokogiri-serif-black.png" align="right"/></div>
2
+
1
3
  # Nokogiri
2
4
 
3
- ## Description
5
+ Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. It provides a sensible, easy-to-understand API for reading, writing, modifying, and querying documents. It is fast and standards-compliant by relying on native parsers like libxml2 (C) and xerces (Java).
6
+
7
+ ## Guiding Principles
8
+
9
+ Some guiding principles Nokogiri tries to follow:
4
10
 
5
- Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among
6
- Nokogiri's many features is the ability to search documents via XPath
7
- or CSS3 selectors.
11
+ - be secure-by-default by treating all documents as **untrusted** by default
12
+ - be a **thin-as-reasonable layer** on top of the underlying parsers, and don't attempt to fix behavioral differences between the parsers
8
13
 
9
14
 
10
- ## Links
15
+ ## Features Overview
11
16
 
12
- * https://nokogiri.org
13
- * [Installation Help](https://nokogiri.org/tutorials/installing_nokogiri.html)
14
- * [Tutorials](https://nokogiri.org/tutorials/toc.html)
15
- * [Cheat Sheet](https://github.com/sparklemotion/nokogiri/wiki/Cheat-sheet)
16
- * [GitHub](https://github.com/sparklemotion/nokogiri)
17
- * [Mailing List](https://groups.google.com/group/nokogiri-talk)
18
- * [Chat/Gitter](https://gitter.im/sparklemotion/nokogiri)
17
+ - DOM Parser for XML and HTML4
18
+ - SAX Parser for XML and HTML4
19
+ - Push Parser for XML and HTML4
20
+ - Document search via XPath 1.0
21
+ - Document search via CSS3 selectors, with some jquery-like extensions
22
+ - XSD Schema validation
23
+ - XSLT transformation
24
+ - "Builder" DSL for XML and HTML documents
19
25
 
20
26
 
21
27
  ## Status
@@ -30,76 +36,118 @@ or CSS3 selectors.
30
36
  [![Tidelift dependencies](https://tidelift.com/badges/package/rubygems/nokogiri)](https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme)
31
37
 
32
38
 
33
- ## Features
39
+ ## Support and Help
34
40
 
35
- * XML/HTML DOM parser which handles broken HTML
36
- * XML/HTML SAX parser
37
- * XML/HTML Push parser
38
- * XPath 1.0 support for document searching
39
- * CSS3 selector support for document searching
40
- * XML/HTML builder
41
- * XSLT transformer
41
+ All official documentation is posted at https://nokogiri.org (the source for which is at https://github.com/sparklemotion/nokogiri.org/, and we welcome contributions).
42
42
 
43
- Nokogiri parses and searches XML/HTML using native libraries (either C
44
- or Java, depending on your Ruby), which means it's fast and
45
- standards-compliant.
43
+ ### Reading
46
44
 
45
+ Your first stops for API documentation should be:
47
46
 
48
- ## Installation
47
+ - RDocs: https://nokogiri.org/rdoc/index.html
48
+ - An excellent community-maintained [Cheat Sheet](https://github.com/sparklemotion/nokogiri/wiki/Cheat-sheet)
49
49
 
50
- If this doesn't work:
51
50
 
52
- ```
53
- gem install nokogiri
54
- ```
51
+ ### Questions
52
+
53
+ If you'd like to talk to a human:
54
+
55
+ - The Discord chat channel is `#nokogiri-💎` at https://discord.gg/UyQnKrT
56
+ - The Gitter chat channel is https://gitter.im/sparklemotion/nokogiri
57
+ - The IRC chat channel is `#nokogiri` on freenode.
58
+ - The Nokogiri mailing list is active at https://groups.google.com/group/nokogiri-talk
59
+ - The Nokogiri bug tracker is at https://github.com/sparklemotion/nokogiri/issues
55
60
 
56
- then please start troubleshooting here:
61
+ Consider subscribing to [Tidelift][tidelift] which provides license assurances and timely security notifications for your open source dependencies, including Nokogiri. [Tidelift][tidelift] subscriptions also help the Nokogiri maintainers fund our [automated testing](https://ci.nokogiri.org) which in turn allows us to ship releases, bugfixes, and security updates more often.
57
62
 
58
- > https://nokogiri.org/tutorials/installing_nokogiri.html
63
+ [tidelift]: https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme
59
64
 
60
- There are currently 1,237 Stack Overflow questions about Nokogiri
61
- installation. The vast majority of them are out of date and therefore
62
- incorrect. __Please do not use Stack Overflow.__
63
65
 
64
- Instead, [tell us](https://nokogiri.org/tutorials/getting_help.html)
65
- when the above instructions don't work for you. This allows us to both
66
- help you directly and improve the documentation.
66
+ ### Security and Vulnerability Reporting
67
67
 
68
+ Please report vulnerabilities at https://hackerone.com/nokogiri
68
69
 
69
- ### Binary packages
70
+ Full information and description of our security policy is in [`SECURITY.md`](SECURITY.md)
70
71
 
71
- Binary packages are available for some distributions.
72
72
 
73
- * Debian: https://packages.debian.org/sid/ruby-nokogiri
74
- * openSUSE/SLE: https://download.opensuse.org/repositories/devel:/languages:/ruby:/extensions/
75
- * Fedora: http://s390.koji.fedoraproject.org/koji/packageinfo?packageID=6756
73
+ ### Semantic Versioning Policy
76
74
 
75
+ Nokogiri follows [Semantic Versioning](https://semver.org/) (since 2017 or so). [![Dependabot's SemVer compatibility score for Nokogiri](https://api.dependabot.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score/?dependency-name=nokogiri&package-manager=bundler)
77
76
 
78
- ## Support
77
+ We bump `Major.Minor.Patch` versions following this guidance:
79
78
 
80
- All official documentation is posted at https://nokogiri.org (the source for which is at https://github.com/sparklemotion/nokogiri.org/, and we welcome contributions).
79
+ `Major`: (we've never done this)
81
80
 
82
- * The Nokogiri mailing list is active: https://groups.google.com/group/nokogiri-talk
83
- * The Nokogiri bug tracker is here: https://github.com/sparklemotion/nokogiri/issues
84
- * Before filing a bug report, please read our submission guidelines: http://nokogiri.org/tutorials/getting_help.html
85
- * The IRC channel is `#nokogiri` on freenode.
86
- * The project's GitHub wiki has an excellent community-maintained [Cheat Sheet](https://github.com/sparklemotion/nokogiri/wiki/Cheat-sheet) which might be useful.
81
+ - Significant backwards-incompatible changes to the public API that would require rewriting existing application code.
82
+ - Some examples of backwards-incompatible changes we might someday consider for a Major release are at [`ROADMAP.md`](ROADMAP.md).
87
83
 
88
- Consider subscribing to [Tidelift][tidelift] which provides license assurances and timely security notifications for your open source dependencies, including Nokogiri. [Tidelift][tidelift] subscriptions also help the Nokogiri maintainers fund our [automated testing](https://ci.nokogiri.org) which in turn allows us to ship releases, bugfixes, and security updates more often.
84
+ `Minor`:
89
85
 
90
- [tidelift]: https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme
86
+ - Features and bugfixes.
87
+ - Updating packaged libraries for non-security-related reasons.
88
+ - Dropping support for EOLed Ruby versions. [Some folks find this objectionable](https://github.com/sparklemotion/nokogiri/issues/1568), but [SemVer says this is OK if the public API hasn't changed](https://semver.org/#what-should-i-do-if-i-update-my-own-dependencies-without-changing-the-public-api).
89
+ - Backwards-incompatible changes to internal or private methods and constants. These are detailed in the "Changes" section of each changelog entry.
91
90
 
91
+ `Patch`:
92
92
 
93
- ## Security and Vulnerability Reporting
93
+ - Bugfixes.
94
+ - Security updates.
95
+ - Updating packaged libraries for security-related reasons.
94
96
 
95
- Please report vulnerabilities at https://hackerone.com/nokogiri
96
97
 
97
- Full information and description of our security policy is in [`SECURITY.md`](SECURITY.md)
98
+ ## Installation
99
+
100
+ Requirements:
101
+
102
+ - Ruby >= 2.5
103
+ - JRuby >= 9.2.0.0
104
+
105
+
106
+ ### Native Gems: Faster, more reliable installation
107
+
108
+ "Native gems" contain pre-compiled libraries for a specific machine architecture. On supported platforms, this removes the need for compiling the C extension and the packaged libraries, or for system dependencies to exist. This results in **much faster installation** and **more reliable installation**, which as you probably know are the biggest headaches for Nokogiri users.
109
+
110
+ ### Supported Platforms
111
+
112
+ As of v1.11.0, Nokogiri ships pre-compiled, "native" gems for the following platforms:
113
+
114
+ - Linux: `x86-linux` and `x86_64-linux` (req: `glibc >= 2.17`), including musl platforms like Alpine
115
+ - Darwin/MacOS: `x86_64-darwin` and `arm64-darwin`
116
+ - Windows: `x86-mingw32` and `x64-mingw32`
117
+ - Java: any platform running JRuby 9.2 or higher
118
+
119
+ To determine whether your system supports one of these gems, look at the output of `bundle platform` or `ruby -e 'puts Gem::Platform.local.to_s'`.
120
+
121
+ If you're on a supported platform, either `gem install` or `bundle install` should install a native gem without any additional action on your part. This installation should only take a few seconds, and your output should look something like:
122
+
123
+ ``` sh
124
+ $ gem install nokogiri
125
+ Fetching nokogiri-1.11.0-x86_64-linux.gem
126
+ Successfully installed nokogiri-1.11.0-x86_64-linux
127
+ 1 gem installed
128
+ ```
129
+
130
+
131
+ ### Other Installation Options
132
+
133
+ Because Nokogiri is a C extension, it requires that you have a C compiler toolchain, Ruby development header files, and some system dependencies installed.
134
+
135
+ The following may work for you if you have an appropriately-configured system:
136
+
137
+ ``` bash
138
+ gem install nokogiri
139
+ ```
98
140
 
141
+ If you have any issues, please visit [Installing Nokogiri](https://nokogiri.org/tutorials/installing_nokogiri.html) for more complete instructions and troubleshooting.
99
142
 
100
- ## Synopsis
101
143
 
102
- Nokogiri is a large library, but here is example usage for parsing and examining a document:
144
+ ## How To Use Nokogiri
145
+
146
+ Nokogiri is a large library, and so it's challenging to briefly summarize it. We've tried to provide long, real-world examples at [Tutorials](https://nokogiri.org/tutorials/toc.html).
147
+
148
+ ### Parsing and Querying
149
+
150
+ Here is example usage for parsing and querying a document:
103
151
 
104
152
  ```ruby
105
153
  #! /usr/bin/env ruby
@@ -110,45 +158,24 @@ require 'open-uri'
110
158
  # Fetch and parse HTML document
111
159
  doc = Nokogiri::HTML(URI.open('https://nokogiri.org/tutorials/installing_nokogiri.html'))
112
160
 
113
- puts "### Search for nodes by css"
161
+ # Search for nodes by css
114
162
  doc.css('nav ul.menu li a', 'article h2').each do |link|
115
163
  puts link.content
116
164
  end
117
165
 
118
- puts "### Search for nodes by xpath"
166
+ # Search for nodes by xpath
119
167
  doc.xpath('//nav//ul//li/a', '//article//h2').each do |link|
120
168
  puts link.content
121
169
  end
122
170
 
123
- puts "### Or mix and match."
171
+ # Or mix and match
124
172
  doc.search('nav ul.menu li a', '//article//h2').each do |link|
125
173
  puts link.content
126
174
  end
127
175
  ```
128
176
 
129
177
 
130
- ## Requirements
131
-
132
- Ruby 2.5.0 or higher, including any development packages necessary to compile native extensions.
133
-
134
- In Nokogiri 1.6.0 and later libxml2 and libxslt are bundled with the gem, but if you want to use the system versions:
135
-
136
- * First, check out [the long list](http://www.xmlsoft.org/news.html)
137
- of fixes and changes between releases before deciding to use any
138
- version older than is bundled with Nokogiri.
139
-
140
- * At install time, set the environment variable
141
- `NOKOGIRI_USE_SYSTEM_LIBRARIES` or else use the
142
- `--use-system-libraries` argument. (See
143
- https://nokogiri.org/tutorials/installing_nokogiri.html#install-with-system-libraries
144
- for specifics.)
145
-
146
- * libxml2 >=2.6.21 with iconv support (libxml2-dev/-devel is also required)
147
-
148
- * libxslt, built with and supported by the given libxml2 (libxslt-dev/-devel is also required)
149
-
150
-
151
- ## Encoding
178
+ ### Encoding
152
179
 
153
180
  Strings are always stored as UTF-8 internally. Methods that return
154
181
  text values will always return UTF-8 encoded strings. Methods that
@@ -174,11 +201,43 @@ explicitly setting the encoding to EUC-JP on the parser:
174
201
  ```
175
202
 
176
203
 
177
- ## Development
204
+ ## Technical Overview
205
+
206
+ ### Guiding Principles
207
+
208
+ As noted above, two guiding principles of the software are:
209
+
210
+ - be secure-by-default by treating all documents as **untrusted** by default
211
+ - be a **thin-as-reasonable layer** on top of the underlying parsers, and don't attempt to fix behavioral differences between the parsers
212
+
213
+ Notably, despite all parsers being standards-compliant, there are behavioral inconsistencies between the parsers used in the CRuby and JRuby implementations, and Nokogiri does not and should not attempt to remove these inconsistencies. Instead, we surface these differences in the test suite when they are important/semantic; or we intentionally write tests to depend only on the important/semantic bits (omitting whitespace from regex matchers on results, for example).
214
+
215
+
216
+ ### CRuby
217
+
218
+ The Ruby (a.k.a., CRuby, MRI, YARV) implementation is a C extension that depends on libxml2 and libxslt (which in turn depend on zlib and possibly libiconv).
219
+
220
+ These dependencies are met by default by Nokogiri's packaged versions of the libxml2 and libxslt source code, but a configuration option `--use-system-libraries` is provided to allow specification of alternative library locations. See [Installing Nokogiri](https://nokogiri.org/tutorials/installing_nokogiri.html) for full documentation.
221
+
222
+ We provide native gems by pre-compiling libxml2 and libxslt (and potentially zlib and libiconv) and packaging them into the gem file. In this case, no compilation is necessary at installation time, which leads to faster and more reliable installation.
223
+
224
+ See [`LICENSE-DEPENDENCIES.md`](LICENSE-DEPENDENCIES.md) for more information on which dependencies are provided in which native and source gems.
225
+
226
+
227
+ ### JRuby
228
+
229
+ The Java (a.k.a. JRuby) implementation is a Java extension that depends primarily on Xerces and NekoHTML for parsing, though additional dependencies are on `isorelax`, `nekodtd`, `jing`, `serializer`, `xalan-j`, and `xml-apis`.
230
+
231
+ These dependencies are provided by pre-compiled jar files packaged in the `java` platform gem.
232
+
233
+ See [`LICENSE-DEPENDENCIES.md`](LICENSE-DEPENDENCIES.md) for more information on which dependencies are provided in which native and source gems.
234
+
235
+
236
+ ## Contributing
178
237
 
179
238
  ```bash
180
- bundle install
181
- bundle exec rake compile test
239
+ bundle install
240
+ bundle exec rake compile test
182
241
  ```
183
242
 
184
243
 
@@ -187,14 +246,27 @@ explicitly setting the encoding to EUC-JP on the parser:
187
246
  We've adopted the Contributor Covenant code of conduct, which you can read in full in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md).
188
247
 
189
248
 
190
- ## Semantic Versioning
191
-
192
- [![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score/?dependency-name=nokogiri&package-manager=bundler)
193
-
194
- Nokogiri follows [Semantic Versioning](https://semver.org/). See [`CHANGELOG.md`](CHANGELOG.md) for more details.
195
-
196
249
  ## License
197
250
 
198
251
  This project is licensed under the terms of the MIT license.
199
252
 
200
253
  See this license at [`LICENSE.md`](LICENSE.md).
254
+
255
+
256
+ ### Dependencies
257
+
258
+ Some additional libraries may be distributed with your version of Nokogiri. Please see [`LICENSE-DEPENDENCIES.md`](LICENSE-DEPENDENCIES.md) for a discussion of the variations as well as the licenses thereof.
259
+
260
+
261
+ ## Authors
262
+
263
+ - Mike Dalessio
264
+ - Aaron Patterson
265
+ - Yoko Harada
266
+ - Akinori MUSHA
267
+ - John Shahid
268
+ - Karol Bucek
269
+ - Lars Kanis
270
+ - Sergio Arbeo
271
+ - Timothy Elliott
272
+ - Nobuyoshi Nakada
@@ -33,6 +33,10 @@ NOKOGIRI_HELP_MESSAGE = <<~HELP
33
33
  --disable-clean
34
34
  Do not clean out intermediate files after successful build
35
35
 
36
+ --prevent-strip
37
+ Take steps to prevent stripping the symbol table and debugging info from the shared
38
+ library, potentially overriding RbConfig's CFLAGS/LDFLAGS/DLDFLAGS.
39
+
36
40
 
37
41
  Flags only used when using system libraries:
38
42
 
@@ -81,6 +85,7 @@ NOKOGIRI_HELP_MESSAGE = <<~HELP
81
85
  --enable-cross-build
82
86
  Enable cross-build mode. (You probably do not want to set this manually.)
83
87
 
88
+
84
89
  Environment variables used:
85
90
 
86
91
  NOKOGIRI_USE_SYSTEM_LIBRARIES
@@ -513,10 +518,22 @@ end
513
518
  # use same c compiler for libxml and libxslt
514
519
  ENV['CC'] = RbConfig::CONFIG['CC']
515
520
 
521
+ if arg_config('--prevent-strip')
522
+ old_cflags = $CFLAGS.split.join(" ")
523
+ old_ldflags = $LDFLAGS.split.join(" ")
524
+ old_dldflags = $DLDFLAGS.split.join(" ")
525
+ $CFLAGS = $CFLAGS.split.reject { |flag| flag == "-s" }.join(" ")
526
+ $LDFLAGS = $LDFLAGS.split.reject { |flag| flag == "-s" }.join(" ")
527
+ $DLDFLAGS = $DLDFLAGS.split.reject { |flag| flag == "-s" }.join(" ")
528
+ puts "Prevent stripping by removing '-s' from $CFLAGS" if old_cflags != $CFLAGS
529
+ puts "Prevent stripping by removing '-s' from $LDFLAGS" if old_ldflags != $LDFLAGS
530
+ puts "Prevent stripping by removing '-s' from $DLDFLAGS" if old_dldflags != $DLDFLAGS
531
+ end
532
+
516
533
  # adopt environment config
517
- append_cflags(ENV["CFLAGS"].split(/\s+/)) if !ENV["CFLAGS"].nil?
518
- append_cppflags(ENV["CPPFLAGS"].split(/\s+/)) if !ENV["CPPFLAGS"].nil?
519
- append_ldflags(ENV["LDFLAGS"].split(/\s+/)) if !ENV["LDFLAGS"].nil?
534
+ append_cflags(ENV["CFLAGS"].split) if !ENV["CFLAGS"].nil?
535
+ append_cppflags(ENV["CPPFLAGS"].split) if !ENV["CPPFLAGS"].nil?
536
+ append_ldflags(ENV["LDFLAGS"].split) if !ENV["LDFLAGS"].nil?
520
537
  $LIBS = concat_flags($LIBS, ENV["LIBS"])
521
538
 
522
539
  append_cflags("-g") # always include debugging information
@@ -11,7 +11,24 @@ end
11
11
  begin
12
12
  RUBY_VERSION =~ /(\d+\.\d+)/
13
13
  require "nokogiri/#{$1}/nokogiri"
14
- rescue LoadError
14
+ rescue LoadError => e
15
+ if e.message =~ /GLIBC/
16
+ warn <<~EOM
17
+
18
+ ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system with glibc < 2.17:
19
+
20
+ #{e.message}
21
+
22
+ If that's the case, then please install Nokogiri via the `ruby` platform gem:
23
+ gem install nokogiri --platform=ruby
24
+ or:
25
+ bundle config set force_ruby_platform true
26
+
27
+ Please visit https://nokogiri.org/tutorials/installing_nokogiri.html for more help.
28
+
29
+ EOM
30
+ raise e
31
+ end
15
32
  require 'nokogiri/nokogiri'
16
33
  end
17
34
  require 'nokogiri/version'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Nokogiri
3
3
  # The version of Nokogiri you are using
4
- VERSION = "1.11.0.rc4"
4
+ VERSION = "1.11.0"
5
5
  end
@@ -0,0 +1,81 @@
1
+ This patch is a result of rake-compiler-dock using centos 7 (manylinux2014) to cross-compile.
2
+
3
+ Centos, for reasons I have not been able to discern, implements `isnan` and `isinf` as a function
4
+ and not as a macro. Debian knows how to resolve that function at dynamic-link time (despite using a
5
+ macro at compile time), but musl-based systems (like alpine) do not. Running `nm` on nokogiri.so
6
+ created on such a centos system shows:
7
+
8
+ ```
9
+ U __isinf@@GLIBC_2.2.5
10
+ U __isnan@@GLIBC_2.2.5
11
+ ```
12
+
13
+ (see https://github.com/sparklemotion/nokogiri/pull/2142 for more info)
14
+
15
+ This patch avoids using glibc's `isnan` and `isinf` calls, instead using libxml2's fallback
16
+ implementation. There's history here, see libxml2 commit 8813f39:
17
+
18
+ commit 8813f39
19
+ Author: Nick Wellnhofer <wellnhofer@aevum.de>
20
+ Date: 2017-09-21 00:11:26 +0200
21
+
22
+ Simplify XPath NaN, inf and -0 handling
23
+
24
+ Use C99 macros NAN, INFINITY, isnan, isinf. If they're not available:
25
+
26
+ - Assume that (0.0 / 0.0) generates a NaN and !(x == x) tests for NaN.
27
+ - Use C89's HUGE_VAL for INFINITY.
28
+
29
+ Remove manual handling of NaN, infinity and negative zero in functions
30
+ xmlXPathValueFlipSign and xmlXPathDivValues.
31
+
32
+ Remove xmlXPathGetSign. All the tests for negative zero can be replaced
33
+ with a test for negative or positive zero.
34
+
35
+ Simplify xmlXPathRoundFunction.
36
+
37
+ Remove Trio dependency.
38
+
39
+ This should work on IEEE 754 compliant implementations even if the C99
40
+ macros aren't available, but will likely break some ancient platforms.
41
+ If problems arise, my plan is to port the relevant trionan.c solution
42
+ to xpath.c. Note that non-compliant implementations are impossible
43
+ to fully support, anyway, since XPath requires IEEE 754.
44
+
45
+ This patch would be unnecessary if any of the following was true:
46
+
47
+ * centos implements these as macros, and doesn't generate an unresolved symbol for either in the shared library
48
+ * we had a way to ensure `__isinf` and `__isnan` resolve on musl (e.g., we implement them locally)
49
+
50
+ diff --git a/xpath.c b/xpath.c
51
+ index 9f64ab9..5b6d999 100644
52
+ --- a/xpath.c
53
+ +++ b/xpath.c
54
+ @@ -509,11 +509,7 @@ xmlXPathInit(void) {
55
+ */
56
+ int
57
+ xmlXPathIsNaN(double val) {
58
+ -#ifdef isnan
59
+ - return isnan(val);
60
+ -#else
61
+ return !(val == val);
62
+ -#endif
63
+ }
64
+
65
+ /**
66
+ @@ -524,15 +520,11 @@ xmlXPathIsNaN(double val) {
67
+ */
68
+ int
69
+ xmlXPathIsInf(double val) {
70
+ -#ifdef isinf
71
+ - return isinf(val) ? (val > 0 ? 1 : -1) : 0;
72
+ -#else
73
+ if (val >= INFINITY)
74
+ return 1;
75
+ if (val <= -INFINITY)
76
+ return -1;
77
+ return 0;
78
+ -#endif
79
+ }
80
+
81
+ #endif /* SCHEMAS or XPATH */
metadata CHANGED
@@ -1,20 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0.rc4
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Dalessio
8
8
  - Aaron Patterson
9
- - John Shahid
10
9
  - Yoko Harada
11
10
  - Akinori MUSHA
11
+ - John Shahid
12
+ - Karol Bucek
12
13
  - Lars Kanis
13
- - Tim Elliott
14
+ - Sergio Arbeo
15
+ - Timothy Elliott
16
+ - Nobuyoshi Nakada
14
17
  autorequire:
15
18
  bindir: bin
16
19
  cert_chain: []
17
- date: 2020-12-29 00:00:00.000000000 Z
20
+ date: 2021-01-04 00:00:00.000000000 Z
18
21
  dependencies:
19
22
  - !ruby/object:Gem::Dependency
20
23
  name: racc
@@ -45,95 +48,33 @@ dependencies:
45
48
  - !ruby/object:Gem::Version
46
49
  version: 2.5.0
47
50
  - !ruby/object:Gem::Dependency
48
- name: concourse
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '0.41'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '0.41'
61
- - !ruby/object:Gem::Dependency
62
- name: hoe
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '3.22'
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: 3.22.1
71
- type: :development
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - "~>"
76
- - !ruby/object:Gem::Version
77
- version: '3.22'
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: 3.22.1
81
- - !ruby/object:Gem::Dependency
82
- name: hoe-bundler
51
+ name: bundler
83
52
  requirement: !ruby/object:Gem::Requirement
84
53
  requirements:
85
54
  - - "~>"
86
55
  - !ruby/object:Gem::Version
87
- version: '1.2'
56
+ version: '2.2'
88
57
  type: :development
89
58
  prerelease: false
90
59
  version_requirements: !ruby/object:Gem::Requirement
91
60
  requirements:
92
61
  - - "~>"
93
62
  - !ruby/object:Gem::Version
94
- version: '1.2'
63
+ version: '2.2'
95
64
  - !ruby/object:Gem::Dependency
96
- name: hoe-debugging
97
- requirement: !ruby/object:Gem::Requirement
98
- requirements:
99
- - - "~>"
100
- - !ruby/object:Gem::Version
101
- version: '2.0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- requirements:
106
- - - "~>"
107
- - !ruby/object:Gem::Version
108
- version: '2.0'
109
- - !ruby/object:Gem::Dependency
110
- name: hoe-gemspec
111
- requirement: !ruby/object:Gem::Requirement
112
- requirements:
113
- - - "~>"
114
- - !ruby/object:Gem::Version
115
- version: '1.0'
116
- type: :development
117
- prerelease: false
118
- version_requirements: !ruby/object:Gem::Requirement
119
- requirements:
120
- - - "~>"
121
- - !ruby/object:Gem::Version
122
- version: '1.0'
123
- - !ruby/object:Gem::Dependency
124
- name: hoe-git
65
+ name: concourse
125
66
  requirement: !ruby/object:Gem::Requirement
126
67
  requirements:
127
68
  - - "~>"
128
69
  - !ruby/object:Gem::Version
129
- version: '1.6'
70
+ version: '0.41'
130
71
  type: :development
131
72
  prerelease: false
132
73
  version_requirements: !ruby/object:Gem::Requirement
133
74
  requirements:
134
75
  - - "~>"
135
76
  - !ruby/object:Gem::Version
136
- version: '1.6'
77
+ version: '0.41'
137
78
  - !ruby/object:Gem::Dependency
138
79
  name: hoe-markdown
139
80
  requirement: !ruby/object:Gem::Requirement
@@ -252,82 +193,75 @@ dependencies:
252
193
  requirements:
253
194
  - - "~>"
254
195
  - !ruby/object:Gem::Version
255
- version: 0.17.0
196
+ version: '0.20'
256
197
  type: :development
257
198
  prerelease: false
258
199
  version_requirements: !ruby/object:Gem::Requirement
259
200
  requirements:
260
201
  - - "~>"
261
202
  - !ruby/object:Gem::Version
262
- version: 0.17.0
203
+ version: '0.20'
263
204
  - !ruby/object:Gem::Dependency
264
- name: rdoc
205
+ name: yard
265
206
  requirement: !ruby/object:Gem::Requirement
266
207
  requirements:
267
- - - ">="
268
- - !ruby/object:Gem::Version
269
- version: '4.0'
270
- - - "<"
208
+ - - "~>"
271
209
  - !ruby/object:Gem::Version
272
- version: '7'
210
+ version: '0.9'
273
211
  type: :development
274
212
  prerelease: false
275
213
  version_requirements: !ruby/object:Gem::Requirement
276
214
  requirements:
277
- - - ">="
278
- - !ruby/object:Gem::Version
279
- version: '4.0'
280
- - - "<"
215
+ - - "~>"
281
216
  - !ruby/object:Gem::Version
282
- version: '7'
283
- description: |-
284
- Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among
285
- Nokogiri's many features is the ability to search documents via XPath
286
- or CSS3 selectors.
217
+ version: '0.9'
218
+ description: |
219
+ Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. It provides a
220
+ sensible, easy-to-understand API for reading, writing, modifying, and querying documents. It is
221
+ fast and standards-compliant by relying on native parsers like libxml2 (C) and xerces (Java).
287
222
  email: nokogiri-talk@googlegroups.com
288
223
  executables:
289
224
  - nokogiri
290
225
  extensions:
291
226
  - ext/nokogiri/extconf.rb
292
227
  extra_rdoc_files:
293
- - LICENSE-DEPENDENCIES.md
294
- - LICENSE.md
295
- - README.md
296
- - ext/nokogiri/html_document.c
297
- - ext/nokogiri/html_element_description.c
298
- - ext/nokogiri/html_entity_lookup.c
299
- - ext/nokogiri/html_sax_parser_context.c
300
- - ext/nokogiri/html_sax_push_parser.c
301
- - ext/nokogiri/nokogiri.c
228
+ - ext/nokogiri/xml_dtd.c
229
+ - ext/nokogiri/xml_xpath_context.c
302
230
  - ext/nokogiri/xml_attr.c
303
- - ext/nokogiri/xml_attribute_decl.c
304
- - ext/nokogiri/xml_cdata.c
305
231
  - ext/nokogiri/xml_comment.c
306
- - ext/nokogiri/xml_document.c
307
- - ext/nokogiri/xml_document_fragment.c
308
- - ext/nokogiri/xml_dtd.c
232
+ - ext/nokogiri/nokogiri.c
233
+ - ext/nokogiri/xml_sax_parser_context.c
234
+ - ext/nokogiri/xml_node_set.c
235
+ - ext/nokogiri/xml_reader.c
236
+ - ext/nokogiri/xml_libxml2_hacks.c
237
+ - ext/nokogiri/xml_cdata.c
309
238
  - ext/nokogiri/xml_element_content.c
239
+ - ext/nokogiri/html_entity_lookup.c
240
+ - ext/nokogiri/xml_namespace.c
241
+ - ext/nokogiri/xml_io.c
242
+ - ext/nokogiri/xml_document.c
310
243
  - ext/nokogiri/xml_element_decl.c
244
+ - ext/nokogiri/xml_schema.c
245
+ - ext/nokogiri/html_document.c
246
+ - ext/nokogiri/xml_processing_instruction.c
247
+ - ext/nokogiri/xml_text.c
248
+ - ext/nokogiri/xml_syntax_error.c
249
+ - ext/nokogiri/xml_document_fragment.c
250
+ - ext/nokogiri/xml_sax_push_parser.c
311
251
  - ext/nokogiri/xml_encoding_handler.c
252
+ - ext/nokogiri/html_sax_push_parser.c
253
+ - ext/nokogiri/xml_relax_ng.c
312
254
  - ext/nokogiri/xml_entity_decl.c
313
- - ext/nokogiri/xml_entity_reference.c
314
- - ext/nokogiri/xml_io.c
315
- - ext/nokogiri/xml_libxml2_hacks.c
316
- - ext/nokogiri/xml_namespace.c
317
255
  - ext/nokogiri/xml_node.c
318
- - ext/nokogiri/xml_node_set.c
319
- - ext/nokogiri/xml_processing_instruction.c
320
- - ext/nokogiri/xml_reader.c
321
- - ext/nokogiri/xml_relax_ng.c
322
- - ext/nokogiri/xml_sax_parser.c
323
- - ext/nokogiri/xml_sax_parser_context.c
324
- - ext/nokogiri/xml_sax_push_parser.c
325
- - ext/nokogiri/xml_schema.c
326
- - ext/nokogiri/xml_syntax_error.c
327
- - ext/nokogiri/xml_text.c
328
- - ext/nokogiri/xml_xpath_context.c
256
+ - ext/nokogiri/xml_entity_reference.c
329
257
  - ext/nokogiri/xslt_stylesheet.c
258
+ - ext/nokogiri/html_sax_parser_context.c
259
+ - ext/nokogiri/xml_sax_parser.c
260
+ - ext/nokogiri/xml_attribute_decl.c
261
+ - ext/nokogiri/html_element_description.c
262
+ - README.md
330
263
  files:
264
+ - Gemfile
331
265
  - LICENSE-DEPENDENCIES.md
332
266
  - LICENSE.md
333
267
  - README.md
@@ -477,6 +411,7 @@ files:
477
411
  - patches/libxml2/0006-htmlParseComment-treat-as-if-it-closed-the-comment.patch
478
412
  - patches/libxml2/0007-use-new-htmlParseLookupCommentEnd-to-find-comment-en.patch
479
413
  - patches/libxml2/0008-use-glibc-strlen.patch
414
+ - patches/libxml2/0009-avoid-isnan-isinf.patch
480
415
  - ports/archives/libxml2-2.9.10.tar.gz
481
416
  - ports/archives/libxslt-1.1.34.tar.gz
482
417
  homepage: https://nokogiri.org
@@ -501,12 +436,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
501
436
  version: 2.5.0
502
437
  required_rubygems_version: !ruby/object:Gem::Requirement
503
438
  requirements:
504
- - - ">"
439
+ - - ">="
505
440
  - !ruby/object:Gem::Version
506
- version: 1.3.1
441
+ version: '0'
507
442
  requirements: []
508
443
  rubygems_version: 3.1.4
509
444
  signing_key:
510
445
  specification_version: 4
511
- summary: Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser
446
+ summary: Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby.
512
447
  test_files: []