Commit graph

8138 commits

Author SHA1 Message Date
Nobuyoshi Nakada
289f3a79b5 [ruby/openssl] Add fallthrough comments
258e30b640
2021-09-12 22:49:07 +09:00
Nobuyoshi Nakada
6920f3dc96 [ruby/openssl] Suppress cast-function-type warnings
0f91e2a6ee
2021-09-12 22:49:05 +09:00
Nobuyoshi Nakada
598d66f6b2 [ruby/openssl] Separate formatting from ossl_make_error
Just append OpenSSL error reason to the given message string
object, which would be alreadly formatted.
Suppress -Wformat-security warning in `ossl_tsfac_create_ts`.

11b1d8a6b8
2021-09-12 22:49:03 +09:00
Nobuyoshi Nakada
c7dce12eb9 [ruby/openssl] Suppress printf format warnings
* Add `printf` format attribute to `ossl_raise`.
* Fix a format specifier in `config_load_bio`.
* Use `ASSUME` for the unreachable condition.

41da2955db
2021-09-12 22:49:01 +09:00
Nobuyoshi Nakada
2bd6c5dc16 [ruby/date] Ignore warned variables
To suppress warnings at the compilation time.

ff21132203
2021-09-09 13:56:13 +09:00
Hiroshi SHIBATA
8f752c95d2
[ruby/fiddle] Use test-unit gem (https://github.com/ruby/fiddle/pull/69)
e08c4c635e

Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2021-09-05 17:43:48 +09:00
Nobuyoshi Nakada
afa33da72b [ruby/fiddle] Create extconf header for MSVC
Not to include parenthesized argument.

c2c921e16a
2021-09-05 17:31:46 +09:00
Nobuyoshi Nakada
ab63f6d854
Refined test [Bug #18140] 2021-09-02 09:11:41 +09:00
Aaron Patterson
8db269edb3
Guard array when appending
This prevents early collection of the array.  The GC doesn't see the
array on the stack when Ruby is compiled with optimizations enabled

Thanks @jhaberman for the test case

[ruby-core:105099] [Bug #18140]
2021-09-01 10:58:20 -07:00
Nobuyoshi Nakada
d3155e3632 [ruby/zlib] Don't print out warnings when finalizing
44a56d36e7
2021-08-31 23:20:42 +09:00
Nobuyoshi Nakada
31c427511c [ruby/zlib] Revert "Don't print out warnings when freeing."
931aa7a272
2021-08-31 23:20:40 +09:00
jory-graham
db154b20cc [ruby/psych] Replace A-Za-z with [:alpha:]
8ec36494fb
2021-08-31 19:34:54 +09:00
Aaron Patterson
9ed2cb26de [ruby/psych] Add quotes to the strings "y" and "n"
'y' and 'n' are kind of ambiguous.  Syck treated y and n literals in
YAML documents as strings.  But this is not what the YAML 1.1 spec says.
YAML 1.1 says they should be treated as booleans.  When we're dumping
documents, we know it's a string, so adding quotes will eliminate the
"ambiguity" in the emitted document

Fixes #443

6a1c30634e
2021-08-31 19:34:46 +09:00
opak
0925fddc80 [ruby/psych] Update lib/psych/scalar_scanner.rb
64cc239557

Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
2021-08-31 19:34:36 +09:00
Alexandr Opak
44353d0dee [ruby/psych] add more tests
8f71222bf3
2021-08-31 19:34:28 +09:00
Alexandr Opak
48b50cb4fe [ruby/psych] fix parsing integer values with '_' at the end
e0bb853014
2021-08-31 19:34:13 +09:00
Tomer Brisker
31ba0921f8 [ruby/psych] Improve float scalar scanner
Previously, `+.inf` was not handled correctly. Additionally, the regexp
was checking for inf and NaN, even though these cases are handled earlier
in the condition. Added a few tests to ensure handling some missing
cases.

6e0e7a1e9f
2021-08-31 19:34:06 +09:00
Samuel Williams
d19af1675c [ruby/zlib] Don't print out warnings when freeing.
098c50255d
2021-08-31 19:33:38 +09:00
Nobuyoshi Nakada
2dd26bed86
[Feature #16972] Add mode: option to Pathname#mkpath 2021-08-31 11:53:41 +09:00
schneems
51070ee5c4 Faster Pathname FileUtils methods
Currently when calling any of the "FileUtils" methods on pathname `require` is called every time even though that library might already be loaded. This is slow:

We can speed it up by either checking first if the constant is already defined, or by using autoload.

Using defined speeds up the action by about 300x and using autoload is about twice as fast as that (600x faster than current require method).

I'm proposing we use autoload:

```ruby
require 'benchmark/ips'

Benchmark.ips do |x|
  autoload(:FileUtils, "fileutils")
  x.report("require") { require 'fileutils' }
  x.report("defined") { require 'fileutils' unless defined?(FileUtils) }
  x.report("autoload") { FileUtils }

  x.compare!
end

# Warming up --------------------------------------
#              require     3.624k i/100ms
#              defined     1.465M i/100ms
#             autoload     2.320M i/100ms
# Calculating -------------------------------------
#              require     36.282k (± 2.4%) i/s -    184.824k in   5.097153s
#              defined     14.539M (± 2.0%) i/s -     73.260M in   5.041161s
#             autoload     23.100M (± 1.9%) i/s -    115.993M in   5.023271s

# Comparison:
#             autoload: 23099779.2 i/s
#              defined: 14538544.9 i/s - 1.59x  (± 0.00) slower
#              require:    36282.3 i/s - 636.67x  (± 0.00) slower
```

Because this autoload is scoped to Pathname it will not change the behavior of existing programs that are not expecting FileUtils to be loaded yet:

```
ruby -rpathname -e "class Pathname; autoload(:FileUtils, 'fileutils'); end; puts FileUtils.exist?"
Traceback (most recent call last):
-e:1:in `<main>': uninitialized constant FileUtils (NameError)
```
2021-08-30 15:18:11 +09:00
Peter Zhu
c08d4067be [Feature #18045] Remove T_PAYLOAD
This commit removes T_PAYLOAD since the new VWA implementation no longer
requires T_PAYLOAD types.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-25 09:28:21 -04:00
Aaron Patterson
0f1e8f38c9 [ruby/fiddle] Improve "offsetof" calculations (https://github.com/ruby/fiddle/pull/90)
I need to get the offset of members inside sub structures.  This patch
adds sub-structure offset support for structs.

cf78eddbb6
2021-08-24 16:18:22 +09:00
Peter Zhu
eddd369e73 Revert "[Feature #18045] Implement size classes for GC"
This reverts commits 48ff7a9f3e
and b2e2cf2ded because it is causing
crashes in SPARC solaris and i386 debian.
2021-08-23 10:54:53 -04:00
Peter Zhu
48ff7a9f3e [Feature #18045] Remove T_PAYLOAD
This commit removes T_PAYLOAD since the new VWA implementation no longer
requires T_PAYLOAD types.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-23 09:15:42 -04:00
Nobuyoshi Nakada
0b9a3371ea [ruby/date] Add zontab.list dependency
7e1ffbf568
2021-08-22 20:28:52 +09:00
Mike Dalessio
c0f4e4ca6d undefine alloc functions for C extensions
per guidance in doc/extension.rdoc, these classes now undefine their
alloc functions:

- ObjectSpace::InternalObjectWrapper
- Socket::Ifaddr
2021-08-20 08:30:06 +09:00
Nobuyoshi Nakada
36ae44ce2c
[ruby/date] Update zonetab.h at 2021-08-11
de7dca353f
2021-08-17 22:57:59 +09:00
Nobuyoshi Nakada
b8f7e8ac6b
Include ruby.h before internal headers to suppress -Wundef warnings 2021-08-09 19:25:18 +09:00
Nobuyoshi Nakada
ae275f67ce Show WorkingSetSize as RSS on Windows 2021-08-05 17:14:38 +09:00
Nobuyoshi Nakada
3b52230452
Define functions using rb_wait_for_single_fd [Bug #18046] 2021-08-01 06:49:07 +09:00
Nobuyoshi Nakada
7564e066ff
Renamed thraed_fd_close as thread_fd 2021-07-29 21:15:04 +09:00
Hiroshi SHIBATA
a889ab486e
Update the latest version of json.gemspec from flori/json 2021-07-29 15:57:58 +09:00
Rhys Powell
e99d2d066f [ruby/psych] fix: use git repository link for LibYAML in docs
LibYAML has moved from their previous Mercurial based hosting on BitBucket to a git repository on GitHub. This commit updates the `Psych` module's documentation to point to this new repository, instead of the old one which is now a 404.

947a84d0dd
2021-07-29 15:54:41 +09:00
Jeremy Evans
b3d62a77d9 [ruby/zlib] Synchronize access to zstream to prevent segfault in multithreaded use
I'm not sure whether this handles all multithreaded use cases,
but this handles the example that crashes almost immediately
and does 10,000,000 total deflates using 100 separate threads.

To prevent the tests from taking forever, the committed test
for this uses only 10,000 deflates across 10 separate threads,
which still causes a segfault in the previous implementation
almost immediately.

Fixes [Bug #17803]

4b1023b3f2
2021-07-28 13:40:03 +09:00
Hiroshi SHIBATA
30d0e5d1ae
[ruby/digest] Also drop to support Ruby 2.4
360a7de366
2021-07-28 11:48:36 +09:00
Hiroshi SHIBATA
260546ba26
[ruby/digest] Use Gemfile instead of Gem::Specification#add_development_dependency
460a6f807e
2021-07-28 11:48:36 +09:00
Hiroshi SHIBATA
5b96f4dd8c
[ruby/digest] Drop to support Ruby 2.3
23dc9c7425
2021-07-28 11:48:36 +09:00
Olle Jonsson
26e859b5c7
[ruby/digest] gemspec: Avoid distributing extraneous files
0a451e0c94
2021-07-28 11:48:36 +09:00
Olle Jonsson
add48acea3
[ruby/digest] gemspec: Explicitly have 0 executables
086d54ba94
2021-07-28 11:48:36 +09:00
Olle Jonsson
478f0ddb5f
[ruby/digest] Experiment: Use a .pre version in gemspec
This makes it slightly more explicit that this is not a definite new version.

2bb5bb78a3
2021-07-28 11:48:36 +09:00
Olle Jonsson
73c5d4d54e
[ruby/digest] Experiment: bump patch version
This is a test, to see if the build failures are about the shipped Ruby master version of this gem.

d2606b2cce
2021-07-28 11:48:36 +09:00
Nobuyoshi Nakada
070557afc4 Distinguish signal and timeout [Bug #16608] 2021-07-25 13:09:03 -07:00
Benoit Daloze
9b972310fa [ruby/racc] Add missing check for rb_block_call()
* It used to be hardcoded since 0affbf9d2c7c5c618b8d3fe191e74d9ae8ad22fc
  but got removed in 23abf3d3fb82afcc26d35769f0dec59dd46de4bb
* This means that since that second commit, rb_iterate() was used unintentionally.

8816ced525
2021-07-18 20:38:34 +09:00
Kazuki Yamaguchi
bd356c6899 [ruby/openssl] Strip trailing spaces
68fa9c86f1
2021-07-18 18:04:50 +09:00
Samuel Williams
3f1d8a18ea [ruby/openssl] Deprecate and rework old (fd) centric functions
[ky: fixed compatibility with older versions of Ruby]

(cherry picked from commit ruby/ruby@45e65f302b)

8d928e0fb9
2021-07-18 17:48:49 +09:00
Benoit Daloze
3975840780 [ruby/openssl] Use rb_block_call() instead of the deprecated rb_iterate() in OpenSSL
* See https://bugs.ruby-lang.org/issues/18025
  and https://github.com/ruby/ruby/pull/4629

b8e4852dcc
2021-07-18 17:48:49 +09:00
Yusuke Nakamura
11651ab703 [ruby/openssl] Add example to OpenSSL::KDF.hkdf method (https://github.com/ruby/openssl/pull/447)
The values from RFC 5869
https://datatracker.ietf.org/doc/html/rfc5869#appendix-A.1

ec14a87f4f
2021-07-18 17:48:49 +09:00
Kazuki Yamaguchi
70f0a802fe [ruby/openssl] use Bundler for dependency management and Rake gem tasks
Back in 2016, we chose not to use Bundler in Ruby/OpenSSL development
because Bundler depended on openssl and could not be used for testing
openssl itself - "bundle exec rake test" would end up with loading two
different versions of openssl at the same time.

This has been resolved long time ago. We can now safely use it for
development dependency management and for Rake tasks.

47283d9161
2021-07-18 17:48:42 +09:00
Vinicius Stock
4f7c3f631a [ruby/openssl] Include peer socket IP address in errors
8a1e3f5085
2021-07-18 17:45:03 +09:00
Yusuke Endoh
3d37e5d11c [ruby/openssl] Add OpenSSL::BN#set_flags and #get_flags
Also, OpenSSL::BN::CONSTTIME is added.

OpenSSL itself had a feature that was vulnerable against a side-channel
attack. The OpenSSL authors determined that it was not a security issue,
and they have already fixed the issue by using BN_set_flags.

https://github.com/openssl/openssl/pull/13888

If a Ruby OpenSSL user was faced with a similar issue, they couldn't
prevent the issue because Ruby OpenSSL lacks a wrapper to BN_set_flags.
For the case, this change introduces the wrapper.

1e565eba89
2021-07-18 17:45:02 +09:00