Граф коммитов

9237 Коммитов

Автор SHA1 Сообщение Дата
Jean Boussier 730e3b2ce0 Stop exposing `rb_str_chilled_p`
[Feature #20205]

Now that chilled strings no longer appear as frozen, there is no
need to offer an API to check for chilled strings.

We however need to change `rb_check_frozen_internal` to no
longer be a macro, as it needs to check for chilled strings.
2024-06-02 13:53:35 +02:00
Nobuyoshi Nakada a720a1c447
Suppress -Wmaybe-uninitialized warnings with LTO 2024-06-01 16:22:31 +09:00
Jean Boussier 15501e13d7 [ruby/stringio] Remove special handling of chilled strings
[Feature #20205]

Followup: https://github.com/ruby/stringio/pull/94

They no longer need to be special cases. If StringIO end up
mutating a chilled string, a warning will be emitted.

https://github.com/ruby/stringio/commit/dc62d65449
2024-05-30 15:11:48 +00:00
Hiroshi SHIBATA 78bfde5d9f
Revert "[ruby/strscan] Doc for StringScanner"
This reverts commit 974ed1408c.
2024-05-30 21:13:10 +09:00
Hiroshi SHIBATA d70b0da482
Revert "Fix reference path for strscan documentation"
This reverts commit 1fa93fb948.
2024-05-30 21:13:01 +09:00
Hiroshi SHIBATA 1fa93fb948
Fix reference path for strscan documentation 2024-05-30 14:29:25 +09:00
Burdette Lamar 974ed1408c
[ruby/strscan] Doc for StringScanner
(https://github.com/ruby/strscan/pull/96)

#peek_byte and #scan_byte not updated (not available in my repo --
sorry).

---------

https://github.com/ruby/strscan/commit/0123da7352

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
2024-05-30 12:34:18 +09:00
Hiroshi SHIBATA 79f9ed3072 [ruby/zlib] Update license files with ruby/ruby
https://github.com/ruby/zlib/commit/8341fa2e20
2024-05-29 23:23:49 +00:00
Mike Dalessio ca2d229e6b Test for compiling without warnings against public headers
Under compilers with WERRORFLAG, MakeMakefile.try_compile treats
warnings as errors, so we can use append_cflags to test whether the
public header files emit warnings with certain flags turned on.

[Regression test for feature #20507]
2024-05-28 07:33:07 +02:00
Nobuyoshi Nakada 4c7ec5e014
ripper: Extend to represent array access and splat 2024-05-21 13:52:30 +09:00
Nobuyoshi Nakada 66446b9435
ripper: Allow parenthesized comma in options 2024-05-21 13:52:29 +09:00
Nobuyoshi Nakada 47efdae602
ripper: Preserve indentation 2024-05-21 13:52:29 +09:00
Nobuyoshi Nakada 147134b474
ripper: Remove rb_ripper_none
Now it is used only for wheter `opt_paren_args` is `none`.  Introduce
a new special node to distinguish an empty parentheses from it .
2024-05-21 13:52:29 +09:00
Nobuyoshi Nakada 2e765c20db
ripper: Short hand for `rb_ary_new_from_args` 2024-05-21 13:52:29 +09:00
Nobuyoshi Nakada 2d92a4afba
ripper: Make `$:n` to refer each grammar values
Ripper DSL uses these values for callbacks, but does not need indexes.
2024-05-21 13:52:29 +09:00
Samuel Giddins e3e1e53098 [ruby/zlib] Avoid double copying into provided outbuf
https://github.com/ruby/zlib/commit/07f44b7546
2024-05-14 21:44:34 +00:00
Samuel Giddins e33336cb37 [ruby/zlib] Avoid allocating intermediary strings when read/readpartial are passed an outbuf
This accounts for a significant number of string allocations when reading rubygems, but we can avoid that in many places by only copying into the outbuf when present

https://github.com/ruby/zlib/commit/d25ef406c1
2024-05-14 21:44:34 +00:00
Samuel Giddins 841b45a442 [ruby/openssl] Add to_text for PKCS7 and Timestamp::Response
https://github.com/ruby/openssl/commit/71cd1e3f5c
2024-05-08 09:39:13 +00:00
Jean Boussier 7d42010fad [ruby/openssl] read: don't clear buffer when nothing can be read
To be consistent with regular Ruby IOs:

```ruby
r, _ = IO.pipe
buf = "garbage".b
r.read_nonblock(10, buf, exception: false) # => :wait_readable
p buf # => "garbage"
```

Ref: 98b8944460

https://github.com/ruby/openssl/commit/08452993d6
2024-05-05 08:00:00 +00:00
yui-knk cf74ff714a Change return value of `gets` function to be `rb_parser_string_t *` instead of `VALUE`
This change reduces parser's dependency on ruby object.
2024-05-04 11:59:10 +09:00
Nobuyoshi Nakada 7662e6fcd5
win32/registry: Shorten with safe navigation operator 2024-05-03 14:49:29 +09:00
Nobuyoshi Nakada 491c38bfcd
win32/registry: Make frozen_string_literal true 2024-05-03 14:49:29 +09:00
Nobuyoshi Nakada 0b091e6675
win32/registry: Refine pack/unpack
* Use 'J' for HANDLE.
* Use 'Q' for QWORD.
* Define template constants.
* Supply zero bytes in `unpackqw` as well as `unpackdw`.
* Use `String#unpack1`.
2024-05-03 14:49:29 +09:00
Jeremy Evans 55720f372d [ruby/openssl] pkcs7: raise PKCS7Error for PKCS7 without content in PKCS7.read_smime
[pkuzco: expanded the fix for other content types]
[ky: adjusted formatting and the exception type]

https://github.com/ruby/openssl/commit/07eceb7f63

Co-authored-by: pkuzco <b.naamneh@gmail.com>
Co-authored-by: Kazuki Yamaguchi <k@rhe.jp>
2024-05-02 16:26:11 +09:00
Jeremy Evans c9aa63a9e0 [ruby/openssl] pkcs7: raise ArgumentError for PKCS7 with no content in PKCS7.new
Fixes [Bug #19974]

[pkuzco: expanded the fix for other content types]
[ky: adjusted formatting and the exception type]

https://github.com/ruby/openssl/commit/27e11f2d1d

Co-authored-by: pkuzco <b.naamneh@gmail.com>
Co-authored-by: Kazuki Yamaguchi <k@rhe.jp>
2024-05-02 16:26:11 +09:00
Kazuki Yamaguchi eb6f0000a4 [ruby/openssl] cipher: fix buffer overflow in Cipher#update
OpenSSL::Cipher#update currently allocates the output buffer with size
(input data length)+(the block size of the cipher). This is insufficient
for the id-aes{128,192,256}-wrap-pad (AES keywrap with padding) ciphers.
They have a block size of 8 bytes, but the output may be up to 15 bytes
larger than the input.

Use (input data length)+EVP_MAX_BLOCK_LENGTH (== 32) as the output
buffer size, instead. OpenSSL doesn't provide a generic way to tell the
maximum required buffer size for ciphers, but this is large enough for
all algorithms implemented in current versions of OpenSSL.

Fixes: https://bugs.ruby-lang.org/issues/20236

https://github.com/ruby/openssl/commit/3035559f54
2024-05-02 16:26:11 +09:00
Jaymz Julian d39993a4ce [ruby/openssl] Fix performance regression in do_write(s)
This causes significant performance issues when using large (>10meg) writes

Fix by adjusting the buffer write function to clear the buffer once, rather than
piece by piece, avoiding a case where a large write (in our case, around
70mbytes) will consume 100% of CPU. This takes a webrick GET request via SSL
from around 200kbyts/sec and consuming 100% of a core, to line speed on gigabit
ethernet and 6% cpu utlization.

https://github.com/ruby/openssl/commit/d4389b425d
2024-05-02 16:24:36 +09:00
Kazuki Yamaguchi f5af620c61 [ruby/openssl] asn1: check error return from i2d_ASN1_TYPE()
i2d_ASN1_TYPE() is not expected to fail, but the return value should be
checked.

https://github.com/ruby/openssl/commit/21ed3c310e
2024-05-02 07:17:35 +00:00
Bart de Water 9d75d9f07c [ruby/openssl] Update Cipher#name to match Digest#name explanation
https://github.com/ruby/openssl/commit/79e6dead6e
2024-04-30 15:05:50 +00:00
Bart de Water cc6657e563 [ruby/openssl] Add OpenSSL::Digest.digests to get a list of available digests
https://github.com/ruby/openssl/commit/08dd3c73b7
2024-04-30 15:05:50 +00:00
Samuel Williams 368ce0758e [ruby/openssl] Further clarification of documentation.
https://github.com/ruby/openssl/commit/0697f2f8b4
2024-04-30 14:51:59 +00:00
Samuel Williams f1afae2459 [ruby/openssl] More documentation.
https://github.com/ruby/openssl/commit/c8377eaf8d
2024-04-30 14:51:59 +00:00
Samuel Williams 1699772ac4 [ruby/openssl] Introduce basic support for `close_read` and `close_write`.
https://github.com/ruby/openssl/commit/c99d24cee9
2024-04-30 14:51:58 +00:00
Nobuyoshi Nakada a6308ca958 ripper: Move DSL line pattern 2024-04-29 08:38:23 +09:00
ydah f9cf923af2 Use user defined parameterizing rules 2024-04-29 08:38:23 +09:00
卜部昌平 c844968b72 ruby tool/update-deps --fix 2024-04-27 21:55:28 +09:00
Sam Aaron 67b79d484f
Enable Ruby to run on Windows with frozen string literals 2024-04-26 15:10:42 +00:00
Nobuyoshi Nakada 91ff2fd9b5 Fix dllimport warnings
From Visual C:
```
../../../../../src/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.c(5): warning C4273: 'rst_any_method': inconsistent dll linkage
D:\a\ruby\ruby\src\ext\-test-\load\resolve_symbol_target\resolve_symbol_target.h(4): note: see previous definition of 'rst_any_method'
../../../../../src/ext/-test-/load/stringify_target/stringify_target.c(5): warning C4273: 'stt_any_method': inconsistent dll linkage
D:\a\ruby\ruby\src\ext\-test-\load\stringify_target\stringify_target.h(4): note: see previous definition of 'stt_any_method'
```

From MinGW gcc:
```
../../../../../src/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.c:5:1: warning: 'rst_any_method' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
compiling ../../../../../src/ext/-test-/marshal/compat/usrcompat.c
    5 | rst_any_method(VALUE klass)
      | ^~~~~~~~~~~~~~
../../../../../src/ext/-test-/load/stringify_target/stringify_target.c:5:1: warning: 'stt_any_method' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
    5 | stt_any_method(VALUE klass)
      | ^~~~~~~~~~~~~~
```
2024-04-24 18:02:09 +09:00
yui-knk 33929ef995 Move encoding object conversion outside of parser
Reduce the parser's dependence on `VALUE` and `rb_enc_from_encoding`.
2024-04-23 13:11:46 +09:00
Nobuyoshi Nakada afa0d58580
Adjust indent [ci skip] 2024-04-23 09:21:38 +09:00
yui-knk 2992e1074a Refactor parser compile functions
Refactor parser compile functions to reduce the dependence
on ruby functions.
This commit includes these changes

1. Refactor `gets`, `input` and `gets_` of `parser_params`

Parser needs two different data structure to get next line, function (`gets`) and input data (`input`).
However `gets_` is used for both function (`call`) and input data (`ptr`).
`call` is used for managing general callback function when `rb_ruby_parser_compile_generic` is used.
`ptr` is used for managing the current pointer on String when `parser_compile_string` is used.
This commit changes parser to used only `gets` and `input` then removes `gets_`.

2. Move parser_compile functions and `gets` functions from parse.y to ruby_parser.c

This change reduces the dependence on ruby functions from parser.

3. Change ruby_parser and ripper to take care of `VALUE input` GC mark

Move the responsibility of calling `rb_gc_mark` for `VALUE input` from parser to ruby_parser and ripper.
`input` is arbitrary data pointer from the viewpoint of parser.

4. Introduce rb_parser_compile_array function

Caller of `rb_parser_compile_generic` needs to take care about GC because ruby_parser doesn’t know
about the detail of `lex_gets` and `input`.
Introduce `rb_parser_compile_array` to reduce the complexity of ast.c.
2024-04-23 07:20:22 +09:00
Nobuyoshi Nakada 801e4a4feb
Remove UPDATE_LIBRARIES
It has not been used since e48375c112.
2024-04-19 14:12:42 +09:00
Jean byroot Boussier 75154dec73 [ruby/stringio] strio_read: preserve buffer encoding on partial
reads
(https://github.com/ruby/stringio/pull/95)

[[Bug #20418]](https://bugs.ruby-lang.org/issues/20418)

Ruby IO#read preserves the encoding on partial read, but change it when
reading the whole IO

from commit https://github.com/ruby/ruby/commit/0ca7036682da:
> * io.c (read_all): should associate default external encoding.
> * io.c (io_read): should NOT associate default external encoding.

https://github.com/ruby/stringio/commit/073172da31

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-04-17 01:29:18 +00:00
Peter Zhu f8f542bd9b [ruby/pathname] Remove check for File.birthtime
File.birthtime has existed since Ruby 2.2, and pathname requires Ruby
>= 2.7.0, so the method will always be there.

https://github.com/ruby/pathname/commit/aca9613bbf
2024-04-16 05:48:57 +00:00
Nobuyoshi Nakada 8d5d6ec6e7
[pty] Fix missing `or` 2024-04-14 20:35:34 +09:00
Nobuyoshi Nakada 3368913be3 [pty] Fix `ptsname_r` fallback
If `posix_openpt` is available, also `ptsname` should be available.
2024-04-14 20:27:05 +09:00
yui-knk 38b8bdb8ea Remove undefined function's prototype declaration
89cfc15207 removed the definition of these functions.
2024-04-14 10:51:16 +09:00
Nobuyoshi Nakada e7f8db9079
[pty] Support `ptsname_r` of glibc
Although glibc `ptsname_r` man page mentions Tru64 and HP-UX, this
function appears to be declared obsolete on both.
2024-04-11 17:57:52 +09:00
Nobuyoshi Nakada 0bc71828b5 [pty] Split `chfunc` into functions in steps
- start a new session
- obtain the new controlling terminal
- drop privileges
- finally, `exec`
2024-04-09 22:50:09 +09:00
Nobuyoshi Nakada c4dadfbd47
Fix a typo, missing `P` in `SETPGRP_VOID` 2024-04-07 20:54:00 +09:00