Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a65c7c8
[rubygems/rubygems] Fix parallel installation issue
deivid-rodriguez Sep 15, 2025
127a8c0
[rubygems/rubygems] Make `--local-git` flag to `bundle plugin install…
deivid-rodriguez Sep 9, 2025
9dedfb6
[rubygems/rubygems] Move error handling to right behind the option
deivid-rodriguez Sep 16, 2025
23fb4d5
[rubygems/rubygems] Make `bundle show --outdated` raise an error
deivid-rodriguez Sep 9, 2025
44a4f88
[rubygems/rubygems] Switch `lockfile_checksums` to be true by default
deivid-rodriguez Sep 9, 2025
da130d2
[rubygems/rubygems] Completely remove passing `--ext` to `bundle gem`…
deivid-rodriguez Sep 9, 2025
3bf695a
[rubygems/rubygems] Pull `Gem.win_platform?` out of a hot path
tenderlove Sep 17, 2025
a4c2777
[rubygems/rubygems] Switch `cache_all` to be `true` by default
deivid-rodriguez Sep 9, 2025
3faf2a3
[ruby/json] parser: Reject invalid surogate pairs more consistently.
byroot Sep 18, 2025
77cd196
[ruby/json] Add branch test coverage when available. Force track all …
robinetmiller Sep 13, 2025
1347131
[ruby/json] Only enable test coverage when running the test suite sta…
byroot Sep 18, 2025
5c59fb5
[ruby/json] Release 2.14.0
byroot Sep 18, 2025
c164394
[ruby/json] fix issue reading off the end of the ByteBuffer if ptr > 0
samyron Sep 18, 2025
807faf5
[ruby/json] Release 2.14.1
byroot Sep 18, 2025
dc406e9
[ruby/json] Avoid scientific notation before exponent 15
byroot Sep 18, 2025
1042a0b
`JSON::Coder` callback now recieve a second argument to mark object keys
byroot Sep 18, 2025
bb25ed6
Update default gems list at 1042a0bdd893a268b23566fcf1bb3a [ci skip]
matzbot Sep 19, 2025
477b1e7
Directly use rb_imemo_new in imemo_fields_new_complex
peterzhu2118 Sep 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ The following default gems are updated.
* io-console 0.8.1
* io-nonblock 0.3.2
* io-wait 0.3.2
* json 2.13.2
* json 2.14.1
* optparse 0.7.0.dev.2
* prism 1.5.1
* psych 5.2.6
Expand Down
20 changes: 14 additions & 6 deletions ext/json/generator/generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ typedef struct JSON_Generator_StateStruct {

enum duplicate_key_action on_duplicate_key;

bool as_json_single_arg;
bool allow_nan;
bool ascii_only;
bool script_safe;
Expand Down Expand Up @@ -1033,6 +1034,13 @@ json_inspect_hash_with_mixed_keys(struct hash_foreach_arg *arg)
}
}

static VALUE
json_call_as_json(JSON_Generator_State *state, VALUE object, VALUE is_key)
{
VALUE proc_args[2] = {object, is_key};
return rb_proc_call_with_block(state->as_json, 2, proc_args, Qnil);
}

static int
json_object_i(VALUE key, VALUE val, VALUE _arg)
{
Expand Down Expand Up @@ -1086,7 +1094,7 @@ json_object_i(VALUE key, VALUE val, VALUE _arg)
default:
if (data->state->strict) {
if (RTEST(data->state->as_json) && !as_json_called) {
key = rb_proc_call_with_block(data->state->as_json, 1, &key, Qnil);
key = json_call_as_json(data->state, key, Qtrue);
key_type = rb_type(key);
as_json_called = true;
goto start;
Expand Down Expand Up @@ -1328,7 +1336,7 @@ static void generate_json_float(FBuffer *buffer, struct generate_json_data *data
/* for NaN and Infinity values we either raise an error or rely on Float#to_s. */
if (!allow_nan) {
if (data->state->strict && data->state->as_json) {
VALUE casted_obj = rb_proc_call_with_block(data->state->as_json, 1, &obj, Qnil);
VALUE casted_obj = json_call_as_json(data->state, obj, Qfalse);
if (casted_obj != obj) {
increase_depth(data);
generate_json(buffer, data, casted_obj);
Expand All @@ -1345,12 +1353,11 @@ static void generate_json_float(FBuffer *buffer, struct generate_json_data *data
}

/* This implementation writes directly into the buffer. We reserve
* the 28 characters that fpconv_dtoa states as its maximum.
* the 32 characters that fpconv_dtoa states as its maximum.
*/
fbuffer_inc_capa(buffer, 28);
fbuffer_inc_capa(buffer, 32);
char* d = buffer->ptr + buffer->len;
int len = fpconv_dtoa(value, d);

/* fpconv_dtoa converts a float to its shortest string representation,
* but it adds a ".0" if this is a plain integer.
*/
Expand Down Expand Up @@ -1417,7 +1424,7 @@ static void generate_json(FBuffer *buffer, struct generate_json_data *data, VALU
general:
if (data->state->strict) {
if (RTEST(data->state->as_json) && !as_json_called) {
obj = rb_proc_call_with_block(data->state->as_json, 1, &obj, Qnil);
obj = json_call_as_json(data->state, obj, Qfalse);
as_json_called = true;
goto start;
} else {
Expand Down Expand Up @@ -1943,6 +1950,7 @@ static int configure_state_i(VALUE key, VALUE val, VALUE _arg)
else if (key == sym_allow_duplicate_key) { state->on_duplicate_key = RTEST(val) ? JSON_IGNORE : JSON_RAISE; }
else if (key == sym_as_json) {
VALUE proc = RTEST(val) ? rb_convert_type(val, T_DATA, "Proc", "to_proc") : Qfalse;
state->as_json_single_arg = proc && rb_proc_arity(proc) == 1;
state_write_value(data, &state->as_json, proc);
}
return ST_CONTINUE;
Expand Down
2 changes: 1 addition & 1 deletion ext/json/lib/json/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module JSON
VERSION = '2.13.2'
VERSION = '2.14.1'
end
7 changes: 6 additions & 1 deletion ext/json/parser/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,11 +713,16 @@ static VALUE json_string_unescape(JSON_ParserState *state, const char *string, c
}
if (pe[0] == '\\' && pe[1] == 'u') {
uint32_t sur = unescape_unicode(state, (unsigned char *) pe + 2);

if ((sur & 0xFC00) != 0xDC00) {
raise_parse_error_at("invalid surrogate pair at %s", state, p);
}

ch = (((ch & 0x3F) << 10) | ((((ch >> 6) & 0xF) + 1) << 16)
| (sur & 0x3FF));
pe += 5;
} else {
unescape = (char *) "?";
raise_parse_error_at("incomplete surrogate pair at %s", state, p);
break;
}
}
Expand Down
23 changes: 12 additions & 11 deletions ext/json/vendor/fpconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#include <string.h>
#include <stdint.h>

#ifdef JSON_DEBUG
#include <assert.h>
#endif

#define npowers 87
#define steppowers 8
#define firstpower -348 /* 10 ^ -348 */
Expand Down Expand Up @@ -320,15 +324,7 @@ static int emit_digits(char* digits, int ndigits, char* dest, int K, bool neg)
{
int exp = absv(K + ndigits - 1);

int max_trailing_zeros = 7;

if(neg) {
max_trailing_zeros -= 1;
}

/* write plain integer */
if(K >= 0 && (exp < (ndigits + max_trailing_zeros))) {

if(K >= 0 && exp < 15) {
memcpy(dest, digits, ndigits);
memset(dest + ndigits, '0', K);

Expand Down Expand Up @@ -432,10 +428,12 @@ static int filter_special(double fp, char* dest)
*
* Input:
* fp -> the double to convert, dest -> destination buffer.
* The generated string will never be longer than 28 characters.
* Make sure to pass a pointer to at least 28 bytes of memory.
* The generated string will never be longer than 32 characters.
* Make sure to pass a pointer to at least 32 bytes of memory.
* The emitted string will not be null terminated.
*
*
*
* Output:
* The number of written characters.
*
Expand Down Expand Up @@ -474,6 +472,9 @@ static int fpconv_dtoa(double d, char dest[28])
int ndigits = grisu2(d, digits, &K);

str_len += emit_digits(digits, ndigits, dest + str_len, K, neg);
#ifdef JSON_DEBUG
assert(str_len <= 32);
#endif

return str_len;
}
2 changes: 1 addition & 1 deletion imemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ rb_imemo_fields_new(VALUE owner, size_t capa)
static VALUE
imemo_fields_new_complex(VALUE owner, size_t capa)
{
VALUE fields = imemo_fields_new(owner, 1);
VALUE fields = rb_imemo_new(imemo_fields, owner, sizeof(struct rb_fields));
IMEMO_OBJ_FIELDS(fields)->as.complex.table = st_init_numtable_with_size(capa);
FL_SET_RAW(fields, OBJ_FIELD_HEAP);
return fields;
Expand Down
26 changes: 11 additions & 15 deletions lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CLI < Thor
}.freeze

def self.start(*)
check_deprecated_ext_option(ARGV) if ARGV.include?("--ext")
check_invalid_ext_option(ARGV) if ARGV.include?("--ext")

super
ensure
Expand Down Expand Up @@ -288,12 +288,11 @@ def update(*gems)
Calling show with [GEM] will list the exact location of that gem on your machine.
D
method_option "paths", type: :boolean, banner: "List the paths of all gems that are required by your Gemfile."
method_option "outdated", type: :boolean, banner: "Show verbose output including whether gems are outdated."
method_option "outdated", type: :boolean, banner: "Show verbose output including whether gems are outdated (removed)."
def show(gem_name = nil)
if ARGV.include?("--outdated")
message = "the `--outdated` flag to `bundle show` will be removed in favor of `bundle show --verbose`"
removed_message = "the `--outdated` flag to `bundle show` has been removed in favor of `bundle show --verbose`"
SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
raise InvalidOption, removed_message
end
require_relative "cli/show"
Show.new(options, gem_name).run
Expand Down Expand Up @@ -658,34 +657,31 @@ def self.reformatted_help_args(args)
end
end

def self.check_deprecated_ext_option(arguments)
# when deprecated version of `--ext` is called
# print out deprecation warning and pretend `--ext=c` was provided
if deprecated_ext_value?(arguments)
message = "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been deprecated. Please select a language, e.g. `--ext=rust` to generate a Rust extension. This gem will now be generated as if `--ext=c` was used."
def self.check_invalid_ext_option(arguments)
# when invalid version of `--ext` is called
if invalid_ext_value?(arguments)
removed_message = "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been removed. Please select a language, e.g. `--ext=rust` to generate a Rust extension."
SharedHelpers.major_deprecation 2, message, removed_message: removed_message
arguments[arguments.index("--ext")] = "--ext=c"
raise InvalidOption, removed_message
end
end

def self.deprecated_ext_value?(arguments)
def self.invalid_ext_value?(arguments)
index = arguments.index("--ext")
next_argument = arguments[index + 1]

# it is ok when --ext is followed with valid extension value
# for example `bundle gem hello --ext c`
return false if EXTENSIONS.include?(next_argument)

# deprecated call when --ext is called with no value in last position
# invalid call when --ext is called with no value in last position
# for example `bundle gem hello_gem --ext`
return true if next_argument.nil?

# deprecated call when --ext is followed by other parameter
# invalid call when --ext is followed by other parameter
# for example `bundle gem --ext --no-ci hello_gem`
return true if next_argument.start_with?("-")

# deprecated call when --ext is followed by gem name
# invalid call when --ext is followed by gem name
# for example `bundle gem --ext hello_gem`
return true if next_argument

Expand Down
6 changes: 5 additions & 1 deletion lib/bundler/cli/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ class CLI::Plugin < Thor
method_option "source", type: :string, default: nil, banner: "URL of the RubyGems source to fetch the plugin from"
method_option "version", type: :string, default: nil, banner: "The version of the plugin to fetch"
method_option "git", type: :string, default: nil, banner: "URL of the git repo to fetch from"
method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from (deprecated)"
method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from (removed)"
method_option "branch", type: :string, default: nil, banner: "The git branch to checkout"
method_option "ref", type: :string, default: nil, banner: "The git revision to check out"
method_option "path", type: :string, default: nil, banner: "Path of a local gem to directly use"
def install(*plugins)
if options.key?(:local_git)
raise InvalidOption, "--local_git has been removed, use --git"
end

Bundler::Plugin.install(plugins, options)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class CLI::Show
def initialize(options, gem_name)
@options = options
@gem_name = gem_name
@verbose = options[:verbose] || options[:outdated]
@verbose = options[:verbose]
@latest_specs = fetch_latest_specs if @verbose
end

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, opti
@locked_sources = []
@originally_locked_specs = @locked_specs
@originally_locked_sources = @locked_sources
@locked_checksums = Bundler.feature_flag.lockfile_checksums?
@locked_checksums = Bundler.settings[:lockfile_checksums]
end

@unlocking_ruby ||= if @ruby_version && locked_ruby_version_object
Expand Down
2 changes: 0 additions & 2 deletions lib/bundler/feature_flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ def self.settings_method(name, key, &default)

(1..10).each {|v| define_method("bundler_#{v}_mode?") { @major_version >= v } }

settings_flag(:cache_all) { bundler_4_mode? }
settings_flag(:global_gem_cache) { bundler_5_mode? }
settings_flag(:lockfile_checksums) { bundler_4_mode? }
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
settings_flag(:update_requires_all_flag) { bundler_5_mode? }

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/man/bundle-config.1
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Generate a \fBgems\.rb\fR instead of a \fBGemfile\fR when running \fBbundle init
The number of gems Bundler can install in parallel\. Defaults to the number of available processors\.
.TP
\fBlockfile_checksums\fR (\fBBUNDLE_LOCKFILE_CHECKSUMS\fR)
Whether Bundler should include a checksums section in new lockfiles, to protect from compromised gem sources\.
Whether Bundler should include a checksums section in new lockfiles, to protect from compromised gem sources\. Defaults to true\.
.TP
\fBno_install\fR (\fBBUNDLE_NO_INSTALL\fR)
Whether \fBbundle package\fR should skip installing gems\.
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/man/bundle-config.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
The number of gems Bundler can install in parallel. Defaults to the number of
available processors.
* `lockfile_checksums` (`BUNDLE_LOCKFILE_CHECKSUMS`):
Whether Bundler should include a checksums section in new lockfiles, to protect from compromised gem sources.
Whether Bundler should include a checksums section in new lockfiles, to protect from compromised gem sources. Defaults to true.
* `no_install` (`BUNDLE_NO_INSTALL`):
Whether `bundle package` should skip installing gems.
* `no_prune` (`BUNDLE_NO_PRUNE`):
Expand Down
9 changes: 1 addition & 8 deletions lib/bundler/man/bundle-plugin.1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.SH "NAME"
\fBbundle\-plugin\fR \- Manage Bundler plugins
.SH "SYNOPSIS"
\fBbundle plugin\fR install PLUGINS [\-\-source=SOURCE] [\-\-version=VERSION] [\-\-git=GIT] [\-\-branch=BRANCH|\-\-ref=REF] [\-\-local\-git=LOCAL_GIT] [\-\-path=PATH]
\fBbundle plugin\fR install PLUGINS [\-\-source=SOURCE] [\-\-version=VERSION] [\-\-git=GIT] [\-\-branch=BRANCH|\-\-ref=REF] [\-\-path=PATH]
.br
\fBbundle plugin\fR uninstall PLUGINS [\-\-all]
.br
Expand Down Expand Up @@ -54,13 +54,6 @@ When you specify \fB\-\-git\fR, you can use \fB\-\-ref\fR to specify any tag, or
Install the plugin gem from a local path\.
.IP
Example: \fBbundle plugin install bundler\-graph \-\-path \.\./bundler\-graph\fR
.TP
\fB\-\-local\-git=LOCAL_GIT\fR
Install the plugin gem from a local Git repository\.
.IP
Example: \fBbundle plugin install bundler\-graph \-\-local\-git \.\./bundler\-graph\fR\.
.IP
This option is deprecated in favor of \fB\-\-git\fR\.
.SS "uninstall"
Uninstall the plugin(s) specified in PLUGINS\.
.P
Expand Down
8 changes: 0 additions & 8 deletions lib/bundler/man/bundle-plugin.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ bundle-plugin(1) -- Manage Bundler plugins

`bundle plugin` install PLUGINS [--source=SOURCE] [--version=VERSION]
[--git=GIT] [--branch=BRANCH|--ref=REF]
[--local-git=LOCAL_GIT]
[--path=PATH]<br>
`bundle plugin` uninstall PLUGINS [--all]<br>
`bundle plugin` list<br>
Expand Down Expand Up @@ -59,13 +58,6 @@ global source specified in Gemfile is ignored.

Example: `bundle plugin install bundler-graph --path ../bundler-graph`

* `--local-git=LOCAL_GIT`:
Install the plugin gem from a local Git repository.

Example: `bundle plugin install bundler-graph --local-git ../bundler-graph`.

This option is deprecated in favor of `--git`.

### uninstall

Uninstall the plugin(s) specified in PLUGINS.
Expand Down
5 changes: 1 addition & 4 deletions lib/bundler/man/bundle-show.1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.SH "NAME"
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
.SH "SYNOPSIS"
\fBbundle show\fR [GEM] [\-\-paths] [\-\-outdated]
\fBbundle show\fR [GEM] [\-\-paths]
.SH "DESCRIPTION"
Without the [GEM] option, \fBshow\fR will print a list of the names and versions of all gems that are required by your [\fBGemfile(5)\fR][Gemfile(5)], sorted by name\.
.P
Expand All @@ -13,7 +13,4 @@ Calling show with [GEM] will list the exact location of that gem on your machine
.TP
\fB\-\-paths\fR
List the paths of all gems that are required by your [\fBGemfile(5)\fR][Gemfile(5)], sorted by gem name\.
.TP
\fB\-\-outdated\fR
Show verbose output including whether gems are outdated\.

4 changes: 0 additions & 4 deletions lib/bundler/man/bundle-show.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ bundle-show(1) -- Shows all the gems in your bundle, or the path to a gem

`bundle show` [GEM]
[--paths]
[--outdated]

## DESCRIPTION

Expand All @@ -20,6 +19,3 @@ machine.
* `--paths`:
List the paths of all gems that are required by your [`Gemfile(5)`][Gemfile(5)],
sorted by gem name.

* `--outdated`:
Show verbose output including whether gems are outdated.
2 changes: 1 addition & 1 deletion lib/bundler/materialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def specs
end

def dependencies
specs.first.runtime_dependencies.map {|d| [d, platform] }
(materialized_spec || specs.first).runtime_dependencies.map {|d| [d, platform] }
end

def materialized_spec
Expand Down
Loading