summaryrefslogtreecommitdiff
path: root/test/ruby/test_io_buffer.rb
AgeCommit message (Collapse)Author
2024-11-06io_buffer.c: Allow copies between overlapping buffers with #copy and ↵Kasumi Hanazuki
#set_string (#11640) The current implementation of `IO::Buffer#copy` and `#set_string` has an undefined behavior when the source and destination memory overlaps, due to the underlying use of the `memcpy` C function. This patch guarantees the methods to be safe even when copying between overlapping buffers by replacing `memcpy` with `memmove`, Fixes: [Bug #20745] Notes: Merged-By: ioquatix <[email protected]>
2024-10-03Add `IO::Buffer` tests for read and write with length & offset. (#11779)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2024-10-01[Bug #20755] Frozen string should not be writable via IO::BufferNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11738
2024-09-30[Bug #20752] Slice of readonly `IO::Buffer` also should be readonlyNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11735
2024-01-15Improve behavioural consistency of unallocated (zero length) `IO::Buffer`. ↵Samuel Williams
(#9532) This makes the behaviour of IO::Buffer.new(0) and IO::Buffer.new.slice(0, 0) consistent. Fixes https://bugs.ruby-lang.org/issues/19542 and https://bugs.ruby-lang.org/issues/18805.
2023-12-27Fix Window private file mapping unlink EACCES issue. (#9358)Samuel Williams
* Don't return early. * Add missing `mapping` assignment. * Make debug logs conditional.
2023-12-25Do not leave test fileNobuyoshi Nakada
Run this test separately because something seems remained unreleased on Windows.
2023-12-25Correctly release the underlying file mapping. (#9340)Samuel Williams
* Avoiding using `Tempfile` which was retaining the file preventing it from unlinking.
2023-12-25IO::Buffer improvements and documentation. (#9329)Samuel Williams
* Restore experimental warnings. * Documentation and code structure improvements. * Improved validation of flags, clarified documentation of argument handling. * Remove inconsistent use of `Example:` and add example to `null?`. * Expose `IO::Buffer#private?` and add test.
2023-10-21Raise TypeError for bad IO::Buffer.map argument (#8728)Charles Oliver Nutter
* Raise TypeError when IO::Buffer.map argument is neither IO nor implements #fileno * Use UNREACHABLE_CODE Co-authored-by: Nobuyoshi Nakada <[email protected]> * Use macro for undef check Co-authored-by: Nobuyoshi Nakada <[email protected]> --------- Co-authored-by: Nobuyoshi Nakada <[email protected]>
2023-10-21Extract IO::Buffer.for string locking test (#8729)Charles Oliver Nutter
String locking with locktmp is not really part of the public API, and the test relies in a side effect of using it to protect the buffer. On other implementations without locktmp this does not fail. Separate into its own test so it can be excluded from public API expectations.
2023-09-14Fix `io_buffer_get_string` default length computation. (#8427)Samuel Williams
* Fix `io_buffer_get_string` default length computation. When an offset bigger than the size is given, the resulting length will be computed incorrectly. Raise an argument error in this case. * Validate all arguments. Notes: Merged-By: ioquatix <[email protected]>
2023-09-13[Bug #19754] Make `IO::Buffer#get_string` check `offset` range (#8016)Nobuyoshi Nakada
Notes: Merged-By: ioquatix <[email protected]>
2023-05-24Improvements to `IO::Buffer` `read`/`write`/`pread`/`pwrite`. (#7826)Samuel Williams
- Fix IO::Buffer `read`/`write` to use a minimum length. Notes: Merged-By: ioquatix <[email protected]>
2023-05-22Fix mutation on shared strings. (#7837)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2023-03-25IO::Buffer#resize: Free internal buffer if new size is zero (#7569)Kasumi Hanazuki
`#resize(0)` on an IO::Buffer with internal buffer allocated will result in calling `realloc(data->base, 0)`. The behavior of `realloc` with size = 0 is implementation-defined (glibc frees the object and returns NULL, while BSDs return an inaccessible object). And thus such usage is deprecated in standard C (upcoming C23 will make it UB). To avoid this problem, just `free`s the memory when the new size is zero. Notes: Merged-By: ioquatix <[email protected]>
2023-02-25Add `IO::Buffer.string` for efficient string creation. (#7364)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2022-12-24Fix missing handling of offset argument in `IO::Buffer` `pread` and ↵Samuel Williams
`pwrite`. (#7012) Notes: Merged-By: ioquatix <[email protected]>
2022-11-10Omit test on IO Buffers which relies on String being embeddedJemma Issroff
There is currently a bug ([#19084]) in how extended strings work in IO Buffers. Object Shapes changes will make the string in this test extended on 32 bit machines. Since this behavior is currently broken (unrelated to object shapes) on 32 bit machines, this test will then fail. We preemptively omit it so that this commit can be reverted once the bug is fixed. Notes: Merged: https://github.com/ruby/ruby/pull/6699
2022-10-19Add support for anonymous shared IO buffers. (#6580)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2022-10-12Improvements to IO::Buffer implementation and documentation. (#6525)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2022-09-26Add several new methods for getting and setting buffer contents. (#6434)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2022-05-10Fix the order of assert_eqaul and remove unused variablesNobuyoshi Nakada
2022-05-09Add basic binary operators (and, or, xor, not) to `IO::Buffer`. (#5893)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2022-05-09Explicit handling of frozen strings in `IO::Buffer#for`. (#5892)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2021-12-23Add fiber scheduler hooks for `pread`/`pwrite`, and add support to `IO::Buffer`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5249 Merged-By: ioquatix <[email protected]>
2021-12-22Extended interface for IO::Buffer & documentation.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5314 Merged-By: ioquatix <[email protected]>
2021-12-21Rename IMMUTABLE to READONLY.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5303
2021-12-21Improve interface for get/set/copy.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5303
2021-12-21Mark non-private mapped files as external.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5303
2021-12-21Default `IO::Buffer#get_string` to use BINARY encoding.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5303
2021-12-21Add tests for `IO::Buffer` `get`/`set`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5303
2021-12-21Rename `to_str` -> `get_string` and add support for encodings.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5303
2021-12-21Improved exception usage/classes.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5303
2021-12-21Fix handling of frozens strings.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5303
2021-12-21Fix mapping invalid non-file object.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5303
2021-12-20Improve IO::Buffer resize and introduce ownership transfer.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5301
2021-12-19Default size for IO::Buffer.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5300
2021-11-23Suppress the “experimental" warnings for `IO::Buffer`Nobuyoshi Nakada
As this warning is emitted just once per processes, needs in each files when parallel testing.
2021-11-17Validate string type when constructing IO::Buffer for string mapping.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5115
2021-11-12Rework implementation of `IO::Buffer.for(string)` to use string locking.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5109
2021-11-12More immutability and locking tests.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5109
2021-11-10IO::Buffer for scheduler interface.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4621