diff --git a/NEWS.md b/NEWS.md index 064263c115277a..e043d15bea9742 100644 --- a/NEWS.md +++ b/NEWS.md @@ -101,7 +101,7 @@ releases. * ipaddr 1.2.9 * 1.2.8 to [v1.2.9][ipaddr-v1.2.9] * json 2.21.0 - * 2.18.0 to [v2.18.1][json-v2.18.1], [v2.19.0][json-v2.19.0], [v2.19.1][json-v2.19.1], [v2.19.2][json-v2.19.2], [v2.19.3][json-v2.19.3], [v2.19.4][json-v2.19.4], [v2.19.5][json-v2.19.5], [v2.19.6][json-v2.19.6], [v2.19.7][json-v2.19.7], [v2.19.8][json-v2.19.8], [v2.19.9][json-v2.19.9], [v2.20.0][json-v2.20.0] + * 2.18.0 to [v2.18.1][json-v2.18.1], [v2.19.0][json-v2.19.0], [v2.19.1][json-v2.19.1], [v2.19.2][json-v2.19.2], [v2.19.3][json-v2.19.3], [v2.19.4][json-v2.19.4], [v2.19.5][json-v2.19.5], [v2.19.6][json-v2.19.6], [v2.19.7][json-v2.19.7], [v2.19.8][json-v2.19.8], [v2.19.9][json-v2.19.9], [v2.20.0][json-v2.20.0], [v2.21.0][json-v2.21.0] * openssl 4.0.2 * 4.0.0 to [v4.0.1][openssl-v4.0.1], [v4.0.2][openssl-v4.0.2] * pp 0.6.4 @@ -270,6 +270,7 @@ A lot of work has gone into making Ractors more stable, performant, and usable. [json-v2.19.8]: https://github.com/ruby/json/releases/tag/v2.19.8 [json-v2.19.9]: https://github.com/ruby/json/releases/tag/v2.19.9 [json-v2.20.0]: https://github.com/ruby/json/releases/tag/v2.20.0 +[json-v2.21.0]: https://github.com/ruby/json/releases/tag/v2.21.0 [openssl-v4.0.1]: https://github.com/ruby/openssl/releases/tag/v4.0.1 [openssl-v4.0.2]: https://github.com/ruby/openssl/releases/tag/v4.0.2 [pp-v0.6.4]: https://github.com/ruby/pp/releases/tag/v0.6.4 diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index c91bf3d6e22857..3fecb09e7e35b7 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -116,6 +116,10 @@ strio_memsize(const void *p) return sizeof(struct StringIO); } +#ifndef RUBY_TYPED_THREAD_SAFE_FREE +#define RUBY_TYPED_THREAD_SAFE_FREE RUBY_TYPED_FREE_IMMEDIATELY +#endif + static const rb_data_type_t strio_data_type = { "strio", { @@ -123,7 +127,7 @@ static const rb_data_type_t strio_data_type = { strio_free, strio_memsize, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED + 0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED }; #define check_strio(self) ((struct StringIO*)rb_check_typeddata((self), &strio_data_type)) diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index dede57218bd173..da02291478c3c4 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -238,6 +238,10 @@ strscan_memsize(const void *ptr) return size; } +#ifndef RUBY_TYPED_THREAD_SAFE_FREE +#define RUBY_TYPED_THREAD_SAFE_FREE RUBY_TYPED_FREE_IMMEDIATELY +#endif + static const rb_data_type_t strscanner_type = { .wrap_struct_name = "StringScanner", .function = { @@ -248,7 +252,7 @@ static const rb_data_type_t strscanner_type = { .dcompact = strscan_compact, #endif }, - .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_EMBEDDABLE + .flags = RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_EMBEDDABLE }; static VALUE diff --git a/spec/ruby/core/integer/bit_count_spec.rb b/spec/ruby/core/integer/bit_count_spec.rb index 6fa06154aae588..c596a533661397 100644 --- a/spec/ruby/core/integer/bit_count_spec.rb +++ b/spec/ruby/core/integer/bit_count_spec.rb @@ -21,11 +21,11 @@ end it "raises an ArgumentError for a negative number" do - -> { -1.bit_count }.should raise_error(ArgumentError) - -> { -19.bit_count }.should raise_error(ArgumentError) - -> { fixnum_min.bit_count }.should raise_error(ArgumentError) - -> { (-2**1000).bit_count }.should raise_error(ArgumentError) - -> { (-2**1000 - 1).bit_count }.should raise_error(ArgumentError) + -> { -1.bit_count }.should.raise(ArgumentError) + -> { -19.bit_count }.should.raise(ArgumentError) + -> { fixnum_min.bit_count }.should.raise(ArgumentError) + -> { (-2**1000).bit_count }.should.raise(ArgumentError) + -> { (-2**1000 - 1).bit_count }.should.raise(ArgumentError) end end end diff --git a/win32/rm.bat b/win32/rm.bat index 8d5aaba14734df..250cee02c1e42c 100755 --- a/win32/rm.bat +++ b/win32/rm.bat @@ -57,11 +57,23 @@ goto :remove_end ::- files under the target directory, instead of the symlink itself. rd /q "%p%" 2> nul && goto :remove_end + ::- If matching files and directory exist, remove the files only first. + del /q "%p%" 2> nul + ::- `del` exits with 0 even when nothing matched, so its result cannot - ::- tell whether directories remain; remove them first. - if "%recursive%" == "-r" for /D %%I in (%p%) do ( - rd /s /q %%I || call set error=%%ERRORLEVEL%% + ::- tell whether directories remain; check if matching entries still + ::- exist instead. + if not exist "%p%" goto :remove_end + + ::- Unless `-r` option is given, do not remove directories; just fail. + if not "%recursive%" == "-r" ( + call set error=1 + goto :remove_end + ) + + ::- Remove remained directories recursively. + for /D %%I in (%p%) do ( + rd /s /q %%I 2> nul || call set error=%%ERRORLEVEL%% ) - if exist "%p%" del /q "%p%" 2> nul :remove_end endlocal & set "error=%error%" & goto :EOF