Hiroshi SHIBATA
f89a334b55
merge revision(s) bccec7fb46
, 5f8ebcada0
, e13575bb79
, 4adcfc8cd7
: [Backport #19584 ]
...
Fix crash in rb_gc_register_address
[Bug #19584 ]
Some C extensions pass a pointer to a global variable to
rb_gc_register_address. However, if a GC is triggered inside of
rb_gc_register_address, then the object could get swept since it does
not exist on the stack.
[Bug #19584 ] Register global variable address before assignment
[Bug #19584 ] Register global variables before assignment
[Bug #19584 ] [DOC] Tweek description of `rb_gc_register_address`
2025-03-13 14:27:06 +09:00
Hiroshi SHIBATA
6dd8bd0d90
merge revision(s) f423f6e10c
: [Backport #21131 ]
...
Ensure IO.copy_stream buffer is an independent string
Otherwise, changes to the buffer by the destination write method
could result in data changing for supposedly independent strings.
Fixes [Bug #21131 ]
2025-03-13 14:27:06 +09:00
nagachika
f150d67b7d
merge revision(s) 8034e9c3d0
: [Backport #20995 ]
...
[Bug #20995 ] Protect `IO.popen` block from exiting by exception
2025-01-11 15:30:06 +09:00
nagachika
3110d5c8ab
merge revision(s) e90b447655
: [Backport #20924 ]
...
[Bug #20924 ] Fix reading with delimiter in wide character encodings
2024-12-15 16:18:43 +09:00
nagachika
0cb1e753ca
Revert "merge revision(s) 5e0c171451
: [Backport #20169 ]"
...
This reverts commit 6b73406833
.
2024-07-15 11:55:41 +09:00
nagachika
6b73406833
merge revision(s) 5e0c171451
: [Backport #20169 ]
...
Make io_fwrite safe for compaction
[Bug #20169 ]
Embedded strings are not safe for system calls without the GVL because
compaction can cause pages to be locked causing the operation to fail
with EFAULT. This commit changes io_fwrite to use rb_str_tmp_frozen_no_embed_acquire,
which guarantees that the return string is not embedded.
2024-07-15 08:50:38 +09:00
Nobuyoshi Nakada
1bfdd68b69
Adjust else
style to be consistent in each files [ci skip]
2024-05-18 20:09:56 +09:00
nagachika
bf6e9299ef
merge revision(s) 2554c5d3b8
: [Backport #20231 ]
...
Don't wait in `io_binwrite_string` if not necessary. (#9792 )
---
io.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
2024-03-31 17:16:26 +09:00
nagachika
ea89527a76
merge revision(s) 0b2613f443
: [Backport #19640 ]
...
`rb_io_puts` should not write zero length strings. (#7806 )
---
io.c | 40 ++++++++++++++++++++++++----------------
test/fiber/test_io.rb | 28 ++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 16 deletions(-)
2023-07-22 13:03:22 +09:00
zverok
d61a4cec61
Docs: path: option for IO.new
2022-12-23 18:09:49 +02:00
Alan Wu
98675ac09c
[DOC] IO#read doesn't always read in binary mode
...
When `maxlen` is `nil`, it uses the data mode of the stream.
For example in the following:
```ruby
File.binwrite("a.txt", "\r\n\r")
p File.open("a.txt", "rt").read # "\n\n"
p File.open("a.txt", "rt").read(3) # "\r\n\r"
```
Note, this newline translation is _not_ specific to Windows.
2022-12-22 13:15:04 -05:00
Samuel Williams
6fd5d2dc00
Introduce IO.new(..., path:)
and promote File#path
to IO#path
. ( #6867 )
2022-12-08 18:19:53 +13:00
Jean Boussier
7390eb43fe
io.c (read_all): grow the buffer exponentially when size is unknown
...
[Feature #6047 ]
Currently it's grown by `BUFSIZ` (1024) on every iteration which is bit wasteful.
Instead we can double the capacity whenever there is less than `BUFSIZ` capacity
left.
2022-12-02 09:53:57 +01:00
S-H-GAMELINKS
1a64d45c67
Introduce encoding check macro
2022-12-02 01:31:27 +09:00
S-H-GAMELINKS
7bc63d6f43
Introduce argf_encoding function
2022-12-02 01:30:01 +09:00
S-H-GAMELINKS
040e0c8d67
Reuse NIL_OR_UNDEF_P macro
2022-12-02 01:19:55 +09:00
S-H-GAMELINKS
1f4f6c9832
Using UNDEF_P macro
2022-11-16 18:58:33 +09:00
Burdette Lamar
0e1e1b1980
[DOC] Enhanced RDoc for IO ( #6669 )
2022-11-09 10:15:39 -06:00
Burdette Lamar
91c28ab2ee
[DOC] Enhanced RDOc for IO ( #6642 )
...
In io.c treats:
#close
#close_read
#close_write
#closed
2022-10-29 14:47:16 -05:00
Samuel Williams
7fcad1fa03
Update Fiber::Scheduler
documentation. ( #6562 )
2022-10-15 21:43:45 +13:00
Samuel Williams
8a420670a2
Introduce Fiber::Scheduler#io_select
hook for non-blocking IO.select
. ( #6559 )
2022-10-15 19:59:04 +13:00
Samuel Williams
d416205341
Copy IO#timeout
on IO#dup
. ( #6546 )
2022-10-15 01:45:51 +13:00
Samuel Williams
1bafa4a59b
Ignore failure to set nonblock mode. ( #6524 )
2022-10-11 10:18:20 +13:00
Samuel Williams
844a9dff88
Try nil
as default for 'default timeout'. ( #6509 )
2022-10-08 14:02:34 +13:00
Samuel Williams
e4f91bbdba
Add IO#timeout attribute and use it for blocking IO operations. ( #5653 )
2022-10-07 21:48:38 +13:00
Burdette Lamar
bbbdb574c5
[DOC] Integrate io_streams.rdoc into io.c ( #6491 )
...
Integrate io_streams.rdoc into io.c
2022-10-06 09:30:12 -05:00
Burdette Lamar
ded895baa9
[DOC] RDoc changes for IO ( #6458 )
...
Moves Expect library doc into io.c.
Changes certain links to local sections, now pointing to sections in doc/io_streams.rdoc.
Removes local sections now superseded by sections in doc/io_streams.rdoc.
2022-10-02 08:24:08 -05:00
Peter Zhu
64200990c4
[ci skip] Fix typos in documentation in io.c
2022-09-16 09:47:32 -04:00
Jeremy Bopp
684353fc03
[Win32] Negative length IO#sysread
...
Raise `ArgumentError` in `IO#sysread` on Windows when given a negative
length.
Fixes [Bug #18880 ]
2022-09-11 23:08:14 +09:00
Nobuyoshi Nakada
e2ccb316b4
[Bug #5317 ] Use rb_off_t
instead of off_t
...
Get rid of the conflict with system-provided small `off_t`.
2022-09-08 23:01:07 +09:00
Jeremy Evans
21cac42385
Raise ArgumentError for IO.foreach with limit of 0
...
Makes behavior consistent with IO.readlines.
Fixes [Bug #18767 ]
2022-08-25 13:36:17 -07:00
Alan Wu
ca8daf70fa
[DOC] Mention Windows text mode EOF marker interpretation
...
I don't think this is super well known so it's worth mentioning as it
can be a pitfall.
See: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen?view=msvc-170
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-08-05 14:34:08 -04:00
Alan Wu
f1057393da
[DOC] Clarify that IO.read
uses text mode
...
See: https://bugs.ruby-lang.org/issues/18882#note-13
[Bug #18882 ]
2022-08-05 14:34:08 -04:00
Nobuyoshi Nakada
431fdc9200
[DOC] Cross references for ARGF
2022-07-28 09:02:23 +09:00
Jeremy Evans
4ad69899b7
Fix documentation for ARGF.inplace_mode{,=}
...
The value affects the name of the backup file created, not the
name of the file modified (as the file is modified in place).
Fixes [Bug #18920 ]
2022-07-27 15:29:00 -07:00
Nobuyoshi Nakada
f42230ff22
Adjust styles [ci skip]
2022-07-27 18:42:27 +09:00
Kaíque Kandy Koga
1cd487d785
[DOC] IO#eof
...
Use IO#eof? instead of I#eof?
2022-07-23 16:57:09 -07:00
Jeremy Evans
7223c0da15
Do not chomp trailing line separator IO#each with nil separator and chomp
...
nil separator means no sepator, so chomp should not remove a line
separator.
Partially Fixes [Bug #18770 ]
2022-07-21 12:55:24 -07:00
Takashi Kokubun
5b21e94beb
Expand tabs [ci skip]
...
[Misc #18891 ]
2022-07-21 09:42:04 -07:00
Jeremy Evans
203f179ce7
Revert "Do not chomp trailing line separator IO#each with nil separator and chomp"
...
This reverts commit 04f86ad0b5
.
This is causing CI issues, reverting for now.
2022-07-21 08:29:50 -07:00
Jeremy Evans
04f86ad0b5
Do not chomp trailing line separator IO#each with nil separator and chomp
...
nil separator means no sepator, so chomp should not remove a line
separator.
Partially Fixes [Bug #18770 ]
2022-07-21 08:13:40 -07:00
Peter Zhu
280b805d04
[DOC] Fix documentation for ARGF#readlines
...
[Bug #18909 ]
2022-07-15 10:30:50 -04:00
Peter Zhu
c8748942f1
[DOC] Fix typo in documentation for IO#readlines
2022-07-14 16:37:47 -04:00
Nobuyoshi Nakada
cd94842922
[Bug #18892 ] Reset ARGF.lineno
after reading shebang
2022-07-07 11:33:07 +09:00
Nobuyoshi Nakada
5ef3c7ea2d
[Bug #18898 ] Fallback invalid external encoding to the default
2022-07-06 18:08:31 +09:00
Samuel Williams
d2166c09b0
Copy IO#wait*
methods from io-wait
gem to io.c
.
2022-06-25 21:17:13 +12:00
Nobuyoshi Nakada
a58611dfb1
Allow to just warn as bool expected, without an exception
2022-06-20 19:35:12 +09:00
S-H-GAMELINKS
420f3ced4d
Using is_ascii_string to check encoding
2022-06-17 12:02:50 +09:00
Samuel Williams
425a46131a
Handle case where write result is zero.
2022-06-13 16:12:18 +12:00
Jeremy Evans
27eb36596a
Stop ignoring 4th positional argument to IO.#{foreach,readlines}
...
Fixes [Bug #18771 ]
2022-06-09 08:22:06 -07:00