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

308 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 348a534153 [ruby/stringio] Copy from the relocated string
When ungetting the string same as the same buffer string, extending
the buffer can move the pointer in the argument.  Reported by manun
Manu (manun) at https://hackerone.com/reports/2805165.

https://github.com/ruby/stringio/commit/95c1194832
2024-11-05 05:01:03 +00:00
Nobuyoshi Nakada 484ea00d2e [ruby/stringio] An empty string should be converted to empty in any encoding
https://github.com/ruby/stringio/commit/ef03f9368d
2024-10-26 13:20:34 +00:00
Nobuyoshi Nakada f513863c81 [ruby/stringio] Unreachable after an invalid argument exception
https://github.com/ruby/stringio/commit/a2aab4721c
2024-10-26 12:55:45 +00:00
Nobuyoshi Nakada 393c5df008 [ruby/stringio] Remove `SafeStringValue`
In Ruby 2.7 and later, it is the same as `StringValue`.

https://github.com/ruby/stringio/commit/561ea67ea8
2024-10-26 12:55:45 +00:00
Hiroshi SHIBATA 32f134bb85
Added pre-release suffix for development version of default gems
https://github.com/ruby/stringio/issues/81
2024-08-31 14:22:17 +09:00
Sutou Kouhei 205da89680 [ruby/stringio] Development of 3.1.2 started.
https://github.com/ruby/stringio/commit/9ad5551160
2024-06-13 09:48:38 +00: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
卜部昌平 c844968b72 ruby tool/update-deps --fix 2024-04-27 21:55:28 +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
Nobuyoshi Nakada 51e6becd39 [ruby/stringio] Extract `readonly_string_p`
https://github.com/ruby/stringio/commit/0da5b725c8
2024-03-27 17:41:38 +00:00
Nobuyoshi Nakada 06563d78a1 [ruby/stringio] Adjust styles [ci skip]
https://github.com/ruby/stringio/commit/4e8e82fc30
2024-03-28 02:27:20 +09:00
Étienne Barrié 0f5ab4ad52 [ruby/stringio] Eagerly defrost chilled strings
[Feature #20390]

https://github.com/ruby/stringio/commit/17ee957f34

Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2024-03-28 02:27:19 +09:00
Nobuyoshi Nakada a1ced60692 [ruby/stringio] NULL StringIO by `StringIO.new(nil)`
https://github.com/ruby/stringio/commit/779f71359d
2024-03-15 04:34:14 +00:00
Nobuyoshi Nakada 578f96afb5 [ruby/stringio] [DOC] Package rdoc files
https://github.com/ruby/stringio/commit/8522c90e4b
2024-03-14 04:30:28 +00:00
Nobuyoshi Nakada c913f3347c [ruby/stringio] [DOC] Add missing documents
https://github.com/ruby/stringio/commit/9cc1dfa19c
2024-03-14 04:30:28 +00:00
Nobuyoshi Nakada 35706c608c [ruby/stringio] [DOC] Add rdoc task
https://github.com/ruby/stringio/commit/5dd52d4aec
2024-03-14 04:30:27 +00:00
Nobuyoshi Nakada 3f8ef7ff7c [ruby/stringio] Define `StringIO::MAX_LENGTH`
https://github.com/ruby/stringio/commit/0205bd1c86
2024-03-13 13:20:23 +00:00
tomoya ishida fd1bafc11f [ruby/stringio] Fix ascii_only? flag in strio_write
(https://github.com/ruby/stringio/pull/77)

Followup of #79

`rb_str_resize()` was changed by b0b9f7201a  .

```c
rb_str_resize(string, shorter) // clear ENC_CODERANGE in some case
rb_str_resize(string, longer) // does not clear ENC_CODERANGE anymore
```

```c
// rb_str_resize in string.c
if (slen > len && ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) {
  ENC_CODERANGE_CLEAR(str);
}
```

I think this change is based on an assumption that appending null bytes
will not change flag `ascii_only?`.

`strio_extend()` will make the string longer if needed, and update the
flags correctly for appending null bytes.
Before `memmove()`, we need to `rb_str_modify()` because updated flags are not
updated for `memmove()`.

https://github.com/ruby/stringio/commit/b31a538576
2024-01-18 03:42:21 +00:00
Nobuyoshi Nakada 6283ae8d36 [ruby/stringio] Update the coderange after overwrite
Fix https://bugs.ruby-lang.org/issues/20185

https://github.com/ruby/stringio/commit/8230552a46
2024-01-16 15:06:22 +00:00
Hiroshi SHIBATA f54369830f Revert "Rollback to released version numbers of stringio and strscan"
This reverts commit 6a79e53823.
2023-12-25 21:12:49 +09:00
Hiroshi SHIBATA 6a79e53823
Rollback to released version numbers of stringio and strscan 2023-12-16 12:00:59 +08:00
Sutou Kouhei def416899d [ruby/stringio] Development of 3.1.1 started.
https://github.com/ruby/stringio/commit/75da93d48f
2023-11-28 01:38:41 +00:00
Benoit Daloze 1c3088117a [ruby/stringio] Do not compile the C extension on TruffleRuby
* Before this it was compiled but not used, because TruffleRuby has
  a stringio.rb in stdlib and .rb has precedence over .so.
  In fact that extension never worked on TruffleRuby,
  because rb_io_extract_modeenc() has never been defined on TruffleRuby.
* So this just skip compiling the extension since compilation of it now fails:
  https://github.com/ruby/openssl/issues/699

https://github.com/ruby/stringio/commit/d791b63df6
2023-11-27 12:21:24 +00:00
Sutou Kouhei 8cd6c65af1 [ruby/stringio] Development of 3.1.0 started.
https://github.com/ruby/stringio/commit/a2f8ef1a6a
2023-11-08 07:04:15 +00:00
Sutou Kouhei 7ed37388fb [ruby/stringio] Add missing row separator encoding conversion
(https://github.com/ruby/stringio/pull/69)

The conversion logic is borrowed from ruby/ruby's io.c:
40391faeab/io.c (L4059-L4079)

Fix ruby/stringio#68

Reported by IWAMOTO Kouichi. Thanks!!!

https://github.com/ruby/stringio/commit/4b170c1a68
2023-11-08 00:46:17 +00:00
Nobuyoshi Nakada 79d0879536 [ruby/stringio] Make STRINGIO_VERSION uniform
https://github.com/ruby/stringio/commit/4400bf3380
2023-11-04 19:28:49 +09:00
Nobuyoshi Nakada b30783e02e [ruby/stringio] Move Java version to Java directory
https://github.com/ruby/stringio/commit/3f90a0d619
2023-11-04 19:28:39 +09:00
Jean byroot Boussier f087f2c74c [ruby/stringio] StringIO#pread: handle 0 length like IO#pread
(https://github.com/ruby/stringio/pull/67)

Fix: https://github.com/ruby/stringio/issues/66

If length is 0, IO#pread don't even try to read the IO, it simply return
the buffer untouched if there is one or a new empty buffer otherwise.

It also doesn't validate the offset when length is 0.

cc @jdelStrother @kou

https://github.com/ruby/stringio/commit/37e9279337

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2023-10-05 07:44:08 +00:00
Burdette Lamar 02022cef53 [ruby/stringio] [DOC] Fix link
(https://github.com/ruby/stringio/pull/65)

https://github.com/ruby/stringio/commit/e3ea087d04
2023-09-22 14:17:07 +00:00
Sutou Kouhei 5ed42c9800
Development of 3.0.9 started. 2023-08-29 18:15:05 +09:00
Jean byroot Boussier fd8dd71996
Implement StringIO#pread (#56)
Both for being closer to real IOs and also because it's a convenient API
in multithreaded scenarios.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2023-08-02 18:18:17 +09:00
Hiroshi SHIBATA c32a30ec09 [ruby/stringio] Development of 3.0.8 started.
https://github.com/ruby/stringio/commit/1587d3698e
2023-06-02 08:20:38 +00:00
Samuel Williams d5a5333168 [ruby/stringio] Avoid direct struct usage.
(https://github.com/ruby/stringio/pull/54)

We will eventually want to refactor this, but for now this is compatible
enough.
2023-06-01 11:41:19 +00:00
NARUSE, Yui 85dcc4866d Revert "Hide most of the implementation of `struct rb_io`. (#6511)"
This reverts commit 18e55fc1e1.

fix [Bug #19704]
https://bugs.ruby-lang.org/issues/19704
This breaks compatibility for extension libraries. Such changes
need a discussion.
2023-06-01 08:43:22 +09:00
Samuel Williams 18e55fc1e1
Hide most of the implementation of `struct rb_io`. (#6511)
* Add rb_io_path and rb_io_open_descriptor.

* Use rb_io_open_descriptor to create PTY objects

* Rename FMODE_PREP -> FMODE_EXTERNAL and expose it

FMODE_PREP I believe refers to the concept of a "pre-prepared" file, but
FMODE_EXTERNAL is clearer about what the file descriptor represents and
aligns with language in the IO::Buffer module.

* Ensure that rb_io_open_descriptor closes the FD if it fails

If FMODE_EXTERNAL is not set, then it's guaranteed that Ruby will be
responsible for closing your file, eventually, if you pass it to
rb_io_open_descriptor, even if it raises an exception.

* Rename IS_EXTERNAL_FD -> RUBY_IO_EXTERNAL_P

* Expose `rb_io_closed_p`.

* Add `rb_io_mode` to get IO mode.

---------

Co-authored-by: KJ Tsanaktsidis <ktsanaktsidis@zendesk.com>
2023-05-30 10:02:40 +09:00
Nobuyoshi Nakada 6987ec45b1 [ruby/stringio] Drop support for ruby 2.6 or earlier
(https://github.com/ruby/stringio/pull/47)

`rb_io_extract_modeenc` has been exported since ruby 2.7.
2023-05-08 07:21:21 +00:00
Nobuyoshi Nakada 409a13e9ea [ruby/stringio] Update write-barrier at copying
http://ci.rvm.jp/results/trunk-asserts@ruby-sp2-docker/4552803

```
verify_internal_consistency_reachable_i: WB miss (O->Y) 0x00007f752ddd5550 [3LM    ] strio (StringIO)strio -> 0x00007f752d19b7d0 [0      ] T_STRING (String) len: 8, capa: 15 "to_strio"
<internal:/tmp/ruby/src/trunk-asserts/lib/rubygems/core_ext/kernel_require.rb>:53: [BUG] gc_verify_internal_consistency: found internal inconsistency.
```

https://github.com/ruby/stringio/commit/2e8ab43cba
2023-05-03 05:38:27 +00:00
Sutou Kouhei 67743d5823 [ruby/stringio] Development of 3.0.7 started.
https://github.com/ruby/stringio/commit/5d39880f70
2023-04-14 06:38:51 +00:00
Matt Valentine-House 5e4b80177e Update the depend files 2023-02-28 09:09:00 -08:00
Jean Boussier 71dae78b89 [ruby/stringio] Implement write barrier on StringIO
It only has a single reference set in 3 places which
makes it fairly easy to implement.

https://github.com/ruby/stringio/commit/009896b973
2023-02-28 03:07:10 +00:00
Matt Valentine-House f38c6552f9 Remove intern/gc.h from Make deps 2023-02-27 10:11:56 -08:00
BurdetteLamar d3ee9e590c [ruby/stringio] Remove (newly unneeded) remarks about aliases
https://github.com/ruby/stringio/commit/60bb320477
2023-02-25 08:38:19 +00:00
Nobuyoshi Nakada 899ea35035
Extract include/ruby/internal/attr/packed_struct.h
Split `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` macros into the
macros bellow:
* `RBIMPL_ATTR_PACKED_STRUCT_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_END`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END`
2023-02-08 12:34:13 +09:00
Nobuyoshi Nakada cbd5de4f88 [ruby/stringio] Development of 3.0.6 started.
https://github.com/ruby/stringio/commit/a7561f447b
2023-02-03 07:49:31 +00:00
Nobuyoshi Nakada 89d9547800 [ruby/stringio] Revert "bump up to 3.0.6" [ci skip]
This reverts commit https://github.com/ruby/stringio/commit/325933500b35.
It is bumped to 3.0.5 in advance but not released yet.

https://github.com/ruby/stringio/commit/af67c36693
2023-02-02 12:44:53 +00:00
Nobuyoshi Nakada 8087ba736e [ruby/stringio] bump up to 3.0.6
https://github.com/ruby/stringio/commit/325933500b
2023-02-02 04:44:38 +00:00
Nobuyoshi Nakada 21dced8b01 [ruby/stringio] [Bug #19389] Fix chomping with longer separator
https://github.com/ruby/stringio/commit/eb322a9716
2023-01-28 13:00:08 +00:00
Sutou Kouhei 10c9ce9d4c bump up to 3.0.5 2022-12-26 15:09:21 +09:00
Hiroshi SHIBATA 7d04cddfef Merge stringio-3.0.4 2022-12-09 16:36:22 +09:00
Sutou Kouhei 8bbf4e5d8d [ruby/stringio] bump up to 3.0.5
https://github.com/ruby/stringio/commit/e62b9d78d3
2022-12-08 20:58:53 +00:00