rubygems-update 4.0.16 → 4.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aebfb272578fbad19c368078f6ffda6bdd58efeb1dc8e88a5b5a427e0acd87aa
4
- data.tar.gz: 2f644c0c209a61d2e958720eff22877e3a48956b8aef92d78ee1f4e872e42c2c
3
+ metadata.gz: 6781781dd2ce13c49c2771fe518b3b13116d37285c607368a0e719e538aadd82
4
+ data.tar.gz: 0f6eb6c051bf17b55057b7c2e30027dd2119acf2dcabeaab6b70834f5d6a59c6
5
5
  SHA512:
6
- metadata.gz: e28f143143e460bf1dd04e184e202723cccc1f686602b012585a662e52f334b8eec464f4d094378a83a630d4ffcc8e398d46f7b03cf0fdac06a57ac364dd3070
7
- data.tar.gz: e8ba8134f48a8fbf5319e4bd4f238ad9bb51cc31f734a7bde9d84c3ebee67fa5426b023f91ed6f0d34c36c151e82518fcfb4715cda9c566a253cdd61178758ab
6
+ metadata.gz: c31326c1bcd80727a77f559b5d6c6c0b51ae74529d3c8b31a0768afe798ec906788ad1b91934e5b63770442822e71a8067dddebaa262327cee3ab2e8c71e8dd7
7
+ data.tar.gz: 184787705ecd74c6c19fe5382a4103ad69e5179672d5de14c5a84e88170ac97b3ad02c2432ba0f139b337a634a96b5d6b70f6431d757a6c4ab3fbc22702fcc4d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.17 / 2026-07-22
4
+
5
+ ### Enhancements:
6
+
7
+ * Validate spec name before writing to the spec cache. Pull request [#9690](https://github.com/ruby/rubygems/pull/9690) by hsbt
8
+ * Installs bundler 4.0.17 as a default gem.
9
+
10
+ ### Bug fixes:
11
+
12
+ * Unquote Gem.ruby when spawning it as a separate argv element. Pull request [#9695](https://github.com/ruby/rubygems/pull/9695) by hsbt
13
+ * Escape glob metacharacters in install paths when globbing. Pull request [#9687](https://github.com/ruby/rubygems/pull/9687) by hsbt
14
+ * Preserve Windows editor paths in gem open and bundle open. Pull request [#9694](https://github.com/ruby/rubygems/pull/9694) by hsbt
15
+ * Preserve Windows paths in MAKE and rake environment variables. Pull request [#9693](https://github.com/ruby/rubygems/pull/9693) by hsbt
16
+ * Fix `bundle` binstub broken by `gem update --system` on Homebrew ruby. Pull request [#9688](https://github.com/ruby/rubygems/pull/9688) by hsbt
17
+
3
18
  ## 4.0.16 / 2026-07-10
4
19
 
5
20
  ### Enhancements:
data/bundler/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.17 / 2026-07-22
4
+
5
+ ### Enhancements:
6
+
7
+ * Open compact index cache in binary mode when appending. Pull request [#9679](https://github.com/ruby/rubygems/pull/9679) by hsbt
8
+
9
+ ### Bug fixes:
10
+
11
+ * Unquote Gem.ruby when spawning it as a separate argv element. Pull request [#9695](https://github.com/ruby/rubygems/pull/9695) by hsbt
12
+ * Escape glob metacharacters in install paths when globbing. Pull request [#9687](https://github.com/ruby/rubygems/pull/9687) by hsbt
13
+ * Avoid space-containing absolute path in RUBYOPT. Pull request [#9696](https://github.com/ruby/rubygems/pull/9696) by hsbt
14
+ * Preserve the locked Bundler checksum when the gem isn't cached. Pull request [#9658](https://github.com/ruby/rubygems/pull/9658) by rwstauner
15
+
16
+ ### Documentation:
17
+
18
+ * Point Bundler gemspec metadata at the moved docs. Pull request [#9648](https://github.com/ruby/rubygems/pull/9648) by hsbt
19
+
3
20
  ## 4.0.16 / 2026-07-10
4
21
 
5
22
  ### Enhancements:
@@ -5,7 +5,7 @@ module Bundler
5
5
  module BuildMetadata
6
6
  # begin ivars
7
7
  @built_at = nil
8
- @git_commit_sha = "fc18079dba".freeze
8
+ @git_commit_sha = "f80cbc4c44".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -18,12 +18,22 @@ module Bundler
18
18
  Bundler.ui.info "Unable to open #{name} because it's a default gem, so the directory it would normally be installed to does not exist."
19
19
  else
20
20
  root_path = spec.full_gem_path
21
- require "shellwords"
22
- command = Shellwords.split(editor) << File.join([root_path, path].compact)
21
+ command = editor_command(editor) << File.join([root_path, path].compact)
23
22
  Bundler.with_original_env do
24
23
  system(*command, { chdir: root_path })
25
24
  end || Bundler.ui.info("Could not run '#{command.join(" ")}'")
26
25
  end
27
26
  end
27
+
28
+ def editor_command(editor)
29
+ # On Windows an editor is often configured with a full path such as
30
+ # C:\Program Files\Microsoft VS Code\Code.exe, which shell splitting
31
+ # would corrupt. Take a value that names an existing file as a
32
+ # single word.
33
+ return [editor] if Gem.win_platform? && File.file?(editor)
34
+
35
+ require "shellwords"
36
+ Shellwords.split(editor)
37
+ end
28
38
  end
29
39
  end
@@ -103,7 +103,7 @@ module Bundler
103
103
  # Returns false without appending when no digests since appending is too error prone to do without digests.
104
104
  def append(data)
105
105
  return false unless digests?
106
- open("a") {|f| f.write data }
106
+ open("ab") {|f| f.write data }
107
107
  verify && commit
108
108
  end
109
109
 
@@ -103,17 +103,40 @@ module Bundler
103
103
  end
104
104
 
105
105
  def bundler_checksum
106
+ # `.dev` versions and `SKIP_BUNDLER_CHECKSUM` are deliberate opt-outs (used
107
+ # by Bundler/RubyGems' own development and release tasks): never record a
108
+ # checksum for Bundler itself in those cases.
106
109
  return [] if Bundler.gem_version.to_s.end_with?(".dev") || ENV["SKIP_BUNDLER_CHECKSUM"]
107
110
 
108
111
  bundler_spec = definition.sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
109
- return [] unless File.exist?(bundler_spec.cache_file)
110
112
 
111
- require "rubygems/package"
113
+ # Record a fresh checksum from the locally cached gem when it's available.
114
+ # When it isn't (e.g. a fresh checkout/CI that never downloaded the bundler
115
+ # gem), fall back to whatever checksum is already locked rather than
116
+ # dropping it, so the entry stays consistent across environments.
117
+ if File.exist?(bundler_spec.cache_file)
118
+ require "rubygems/package"
119
+
120
+ package = Gem::Package.new(bundler_spec.cache_file)
121
+ definition.sources.metadata_source.checksum_store.register(bundler_spec, Checksum.from_gem_package(package))
122
+ elsif bundled_with_changing?
123
+ # We can't compute a fresh checksum (the bundler gem isn't cached) and the
124
+ # BUNDLED WITH version is changing. Keeping the previously locked checksum
125
+ # would leave a `bundler (<old version>) sha256=...` entry that no longer
126
+ # matches the new BUNDLED WITH version, so drop it instead.
127
+ return []
128
+ end
112
129
 
113
- package = Gem::Package.new(bundler_spec.cache_file)
114
- definition.sources.metadata_source.checksum_store.register(bundler_spec, Checksum.from_gem_package(package))
130
+ return [] if definition.sources.metadata_source.checksum_store.missing?(bundler_spec)
115
131
 
116
132
  [definition.sources.metadata_source.checksum_store.to_lock(bundler_spec)]
117
133
  end
134
+
135
+ def bundled_with_changing?
136
+ locked_gems = definition.locked_gems
137
+ return false unless locked_gems
138
+
139
+ locked_gems.bundler_version != definition.bundler_version_to_lock
140
+ end
118
141
  end
119
142
  end
@@ -141,7 +141,7 @@ module Bundler
141
141
  end
142
142
  end
143
143
 
144
- Dir[cache_path.join("*/.git")].each do |git_dir|
144
+ Gem::Util.glob_files_in_dir("*/.git", cache_path.to_s).each do |git_dir|
145
145
  FileUtils.rm_rf(git_dir)
146
146
  FileUtils.touch(File.expand_path("../.bundlecache", git_dir))
147
147
  end
@@ -159,13 +159,13 @@ module Bundler
159
159
  end
160
160
 
161
161
  def clean(dry_run = false)
162
- gem_bins = Dir["#{Gem.dir}/bin/*"]
163
- git_dirs = Dir["#{Gem.dir}/bundler/gems/*"]
164
- git_cache_dirs = Dir["#{Gem.dir}/cache/bundler/git/*"]
165
- gem_dirs = Dir["#{Gem.dir}/gems/*"]
166
- gem_files = Dir["#{Gem.dir}/cache/*.gem"]
167
- gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"]
168
- extension_dirs = Dir["#{Gem.dir}/extensions/*/*/*"] + Dir["#{Gem.dir}/bundler/gems/extensions/*/*/*"]
162
+ gem_bins = Gem::Util.glob_files_in_dir("bin/*", Gem.dir)
163
+ git_dirs = Gem::Util.glob_files_in_dir("bundler/gems/*", Gem.dir)
164
+ git_cache_dirs = Gem::Util.glob_files_in_dir("cache/bundler/git/*", Gem.dir)
165
+ gem_dirs = Gem::Util.glob_files_in_dir("gems/*", Gem.dir)
166
+ gem_files = Gem::Util.glob_files_in_dir("cache/*.gem", Gem.dir)
167
+ gemspec_files = Gem::Util.glob_files_in_dir("specifications/*.gemspec", Gem.dir)
168
+ extension_dirs = Gem::Util.glob_files_in_dir("extensions/*/*/*", Gem.dir) + Gem::Util.glob_files_in_dir("bundler/gems/extensions/*/*/*", Gem.dir)
169
169
  spec_gem_paths = []
170
170
  # need to keep git sources around
171
171
  spec_git_paths = @definition.spec_git_paths
@@ -232,7 +232,7 @@ module Bundler
232
232
  private
233
233
 
234
234
  def prune_gem_cache(resolve, cache_path)
235
- cached = Dir["#{cache_path}/*.gem"]
235
+ cached = Gem::Util.glob_files_in_dir("*.gem", cache_path.to_s)
236
236
 
237
237
  cached = cached.delete_if do |path|
238
238
  spec = Bundler.rubygems.spec_from_gem path
@@ -257,7 +257,7 @@ module Bundler
257
257
  end
258
258
 
259
259
  def prune_git_and_path_cache(resolve, cache_path)
260
- cached = Dir["#{cache_path}/*/.bundlecache"]
260
+ cached = Gem::Util.glob_files_in_dir("*/.bundlecache", cache_path.to_s)
261
261
 
262
262
  cached = cached.delete_if do |path|
263
263
  name = File.basename(File.dirname(path))
@@ -283,7 +283,7 @@ module Bundler
283
283
  # Add man/ subdirectories from activated bundles to MANPATH for man(1)
284
284
  manuals = $LOAD_PATH.filter_map do |path|
285
285
  man_subdir = path.sub(/lib$/, "man")
286
- man_subdir unless Dir[man_subdir + "/man?/"].empty?
286
+ man_subdir unless Dir.glob("man?/", base: man_subdir).empty?
287
287
  end
288
288
 
289
289
  return if manuals.empty?
@@ -75,7 +75,12 @@ module Bundler
75
75
 
76
76
  argv0 = File.exist?($PROGRAM_NAME) ? $PROGRAM_NAME : Process.argv0
77
77
  cmd = [argv0, *ARGV]
78
- cmd.unshift(Gem.ruby) unless File.executable?(argv0)
78
+ unless File.executable?(argv0)
79
+ # Gem.ruby is quoted if it contains whitespace, so split it into argv
80
+ # elements to keep the quotes out of the exec'd command.
81
+ require "shellwords"
82
+ cmd.unshift(*Shellwords.split(Gem.ruby))
83
+ end
79
84
 
80
85
  Bundler.with_original_env do
81
86
  Kernel.exec(
@@ -346,7 +346,12 @@ module Bundler
346
346
 
347
347
  def set_rubyopt
348
348
  rubyopt = [ENV["RUBYOPT"]].compact
349
- setup_require = "-r#{File.expand_path("setup", __dir__)}"
349
+ setup_path = File.expand_path("setup", __dir__)
350
+ # RUBYOPT is split on whitespace with no quoting mechanism, so an
351
+ # absolute path containing spaces would be torn apart. Fall back to
352
+ # requiring by feature name; set_rubylib puts our lib directory first
353
+ # on the child's load path.
354
+ setup_require = /\s/.match?(setup_path) ? "-rbundler/setup" : "-r#{setup_path}"
350
355
  return if !rubyopt.empty? && rubyopt.first.include?(setup_require)
351
356
  rubyopt.unshift setup_require
352
357
  Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
@@ -320,7 +320,7 @@ module Bundler
320
320
 
321
321
  def serialize_gemspecs_in(destination)
322
322
  destination = destination.expand_path(Bundler.root) if destination.relative?
323
- Dir["#{destination}/#{@glob}"].each do |spec_path|
323
+ Gem::Util.glob_files_in_dir(@glob, destination.to_s).each do |spec_path|
324
324
  # Evaluate gemspecs and cache the result. Gemspecs
325
325
  # in git might require git or other dependencies.
326
326
  # The gemspecs we cache should already be evaluated.
@@ -406,7 +406,7 @@ module Bundler
406
406
  @cached_specs ||= begin
407
407
  idx = Index.new
408
408
 
409
- Dir["#{cache_path}/*.gem"].each do |gemfile|
409
+ Gem::Util.glob_files_in_dir("*.gem", cache_path.to_s).each do |gemfile|
410
410
  s ||= Bundler.rubygems.spec_from_gem(gemfile)
411
411
  s.source = self
412
412
  idx << s
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "4.0.16".freeze
4
+ VERSION = "4.0.17".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= gem_version.segments.first
@@ -306,9 +306,7 @@ class Gem::BasicSpecification
306
306
  # Return all files in this gem that match for +glob+.
307
307
 
308
308
  def matches_for_glob(glob) # TODO: rename?
309
- glob = File.join(lib_dirs_glob, glob)
310
-
311
- Dir[glob]
309
+ Gem::Util.glob_files_in_dir(File.join(lib_dirs, glob), full_gem_path)
312
310
  end
313
311
 
314
312
  ##
@@ -323,17 +321,7 @@ class Gem::BasicSpecification
323
321
  # for this spec.
324
322
 
325
323
  def lib_dirs_glob
326
- dirs = if raw_require_paths
327
- if raw_require_paths.size > 1
328
- "{#{raw_require_paths.join(",")}}"
329
- else
330
- raw_require_paths.first
331
- end
332
- else
333
- "lib" # default value for require_paths for bundler/inline
334
- end
335
-
336
- "#{full_gem_path}/#{dirs}"
324
+ "#{full_gem_path}/#{lib_dirs}"
337
325
  end
338
326
 
339
327
  ##
@@ -364,6 +352,22 @@ class Gem::BasicSpecification
364
352
 
365
353
  private
366
354
 
355
+ ##
356
+ # Returns the require_paths of this gem as a string usable in Dir.glob,
357
+ # relative to full_gem_path.
358
+
359
+ def lib_dirs
360
+ if raw_require_paths
361
+ if raw_require_paths.size > 1
362
+ "{#{raw_require_paths.join(",")}}"
363
+ else
364
+ raw_require_paths.first
365
+ end
366
+ else
367
+ "lib" # default value for require_paths for bundler/inline
368
+ end
369
+ end
370
+
367
371
  def have_extensions?
368
372
  !extensions.empty?
369
373
  end
@@ -70,7 +70,18 @@ class Gem::Commands::OpenCommand < Gem::Command
70
70
  end
71
71
 
72
72
  def open_editor(path)
73
- system(*@editor.split(/\s+/) + [path], { chdir: path })
73
+ system(*editor_command(@editor), path, { chdir: path })
74
+ end
75
+
76
+ def editor_command(editor) # :nodoc:
77
+ # On Windows an editor is often configured with a full path such as
78
+ # C:\Program Files\Microsoft VS Code\Code.exe, which shell splitting
79
+ # would corrupt. Take a value that names an existing file as a
80
+ # single word.
81
+ return [editor] if Gem.win_platform? && File.file?(editor)
82
+
83
+ require "shellwords"
84
+ Shellwords.split(editor)
74
85
  end
75
86
 
76
87
  def spec_for(name)
@@ -356,16 +356,30 @@ By default, this RubyGems will install gem as:
356
356
  loaded_from = current_default_spec.loaded_from
357
357
  File.delete(loaded_from)
358
358
 
359
- # Remove previous default gem executables if they were not shadowed by a regular gem
360
- FileUtils.rm_rf current_default_spec.full_gem_path if all_specs_current_version.size == 1
359
+ previous_specs_dir = File.dirname(loaded_from)
360
+
361
+ # Remove previous default gem executables if they were not shadowed by a
362
+ # regular gem. They live under the same root as the previous default
363
+ # gemspec, which is not necessarily default_dir.
364
+ if all_specs_current_version.size == 1
365
+ previous_root = File.dirname(File.dirname(previous_specs_dir))
366
+ FileUtils.rm_rf File.join(previous_root, "gems", current_default_spec.full_name)
367
+ end
361
368
 
362
- File.dirname(loaded_from)
369
+ previous_specs_dir
363
370
  else
364
371
  target_specs_dir = File.join(default_dir, "specifications", "default")
365
372
  mkdir_p target_specs_dir, mode: 0o755
366
373
  target_specs_dir
367
374
  end
368
375
 
376
+ # Root directory that specs_dir belongs to. It may differ from default_dir
377
+ # when Gem.default_specifications_dir is customized to live under a
378
+ # different root, like Homebrew does. Executables must be extracted under
379
+ # the same root as the default gemspec, since that's where activation of
380
+ # the default gem will look for them.
381
+ bundler_install_dir = File.dirname(File.dirname(specs_dir))
382
+
369
383
  new_bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
370
384
  full_name = new_bundler_spec.full_name
371
385
  gemspec_path = "#{full_name}.gemspec"
@@ -373,19 +387,20 @@ By default, this RubyGems will install gem as:
373
387
  default_spec_path = File.join(specs_dir, gemspec_path)
374
388
  Gem.write_binary(default_spec_path, new_bundler_spec.to_ruby)
375
389
 
376
- bundler_spec = Gem::Specification.load(default_spec_path)
377
-
378
390
  # Remove gemspec that was same version of vendored bundler.
379
391
  normal_gemspec = File.join(default_dir, "specifications", gemspec_path)
380
392
  if File.file? normal_gemspec
381
393
  File.delete normal_gemspec
382
394
  end
383
395
 
384
- # Remove gem files that were same version of vendored bundler.
385
- if File.directory? bundler_spec.gems_dir
386
- Dir.entries(bundler_spec.gems_dir).
387
- select {|default_gem| File.basename(default_gem) == full_name }.
388
- each {|default_gem| rm_r File.join(bundler_spec.gems_dir, default_gem) }
396
+ # Remove gem files that were same version of vendored bundler. A regular
397
+ # gem lives under default_dir, which is not necessarily the same root as
398
+ # the default gemspec.
399
+ normal_gems_dir = File.join(default_dir, "gems")
400
+ if File.directory? normal_gems_dir
401
+ Dir.entries(normal_gems_dir).
402
+ select {|normal_gem| File.basename(normal_gem) == full_name }.
403
+ each {|normal_gem| rm_r File.join(normal_gems_dir, normal_gem) }
389
404
  end
390
405
 
391
406
  require_relative "../installer"
@@ -399,14 +414,14 @@ By default, this RubyGems will install gem as:
399
414
  format_executable: options[:format_executable],
400
415
  force: options[:force],
401
416
  bin_dir: bin_dir,
402
- install_dir: default_dir,
417
+ install_dir: bundler_install_dir,
403
418
  wrappers: true
404
419
  )
405
- # We need to install only executable and default spec files.
406
- # lib/bundler.rb and lib/bundler/* are available under the site_ruby directory.
420
+ # We only need to install the executables here. The default spec was
421
+ # already written above, and lib/bundler.rb and lib/bundler/* are
422
+ # available under the site_ruby directory.
407
423
  installer.extract_bin
408
424
  installer.generate_bin
409
- installer.write_default_spec
410
425
  ensure
411
426
  FileUtils.rm_f built_gem
412
427
  end
@@ -183,7 +183,10 @@ command to remove old versions.
183
183
  say "Installing RubyGems #{version}" unless options[:silent]
184
184
 
185
185
  installed = preparing_gem_layout_for(version) do
186
- system Gem.ruby, "--disable-gems", "setup.rb", *args
186
+ # Gem.ruby is quoted if it contains whitespace, so split it into argv
187
+ # elements to keep the quotes out of the spawned command.
188
+ require "shellwords"
189
+ system(*Shellwords.split(Gem.ruby), "--disable-gems", "setup.rb", *args)
187
190
  end
188
191
 
189
192
  unless options[:silent]
@@ -32,7 +32,7 @@ class Gem::Ext::Builder
32
32
  target_rbconfig["configure_args"] =~ /with-make-prog\=(\w+)/
33
33
  make_program_name = ENV["MAKE"] || ENV["make"] || $1
34
34
  make_program_name ||= RUBY_PLATFORM.include?("mswin") ? "nmake" : "make"
35
- make_program = shellsplit(make_program_name)
35
+ make_program = shellsplit_command(make_program_name)
36
36
 
37
37
  is_nmake = /\bnmake/i.match?(make_program_name)
38
38
  # The installation of the bundled gems is failed when DESTDIR is empty in mswin platform.
@@ -102,6 +102,10 @@ class Gem::Ext::Builder
102
102
  require "open3"
103
103
  # Set $SOURCE_DATE_EPOCH for the subprocess.
104
104
  build_env = { "SOURCE_DATE_EPOCH" => Gem.source_date_epoch_string }.merge(env)
105
+ # A single-element command would be parsed as a shell command line,
106
+ # splitting an unquoted command path containing spaces. Use the
107
+ # [cmdname, argv0] form to keep exec semantics.
108
+ command = [[command.first, command.first]] if command.size == 1
105
109
  output, status = begin
106
110
  Open3.popen2e(build_env, *command, chdir: dir) do |stdin, stdouterr, wait_thread|
107
111
  stdin.close
@@ -148,6 +152,21 @@ class Gem::Ext::Builder
148
152
  Shellwords.split(command)
149
153
  end
150
154
 
155
+ ##
156
+ # Splits a command string such as ENV["MAKE"] into an argument list.
157
+ #
158
+ # On Windows, a value that names an existing file, such as
159
+ # <tt>C:\path\nmake.exe</tt>, is taken as a single word because POSIX
160
+ # shell splitting would consume the backslashes as escape characters.
161
+ # Any other value is split like a POSIX shell command line, where a
162
+ # path containing spaces must be quoted.
163
+
164
+ def self.shellsplit_command(command)
165
+ return [command] if Gem.win_platform? && File.file?(command)
166
+
167
+ shellsplit(command)
168
+ end
169
+
151
170
  def self.shelljoin(command)
152
171
  require "shellwords"
153
172
 
@@ -14,13 +14,15 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
14
14
  end
15
15
 
16
16
  if /mkrf_conf/i.match?(File.basename(extension))
17
- run([Gem.ruby, File.basename(extension), *args], results, class_name, extension_dir)
17
+ # Gem.ruby is quoted if it contains whitespace, so split it into argv
18
+ # elements to keep the quotes out of the spawned command.
19
+ run([*shellsplit(Gem.ruby), File.basename(extension), *args], results, class_name, extension_dir)
18
20
  end
19
21
 
20
22
  rake = ENV["rake"]
21
23
 
22
24
  if rake
23
- rake = shellsplit(rake)
25
+ rake = shellsplit_command(rake)
24
26
  else
25
27
  begin
26
28
  rake = ruby << "-rrubygems" << Gem.bin_path("rake", "rake")
@@ -109,6 +109,13 @@ class Gem::Source
109
109
 
110
110
  spec_file_name = name_tuple.spec_name
111
111
 
112
+ # The name tuple comes from a remote index and is not otherwise
113
+ # validated, so refuse anything that would escape the spec cache
114
+ # directory when used as a path component.
115
+ if File.basename(spec_file_name) != spec_file_name
116
+ raise Gem::Exception, "malformed spec name: #{spec_file_name.inspect}"
117
+ end
118
+
112
119
  source_uri = enforce_trailing_slash(uri) + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"
113
120
 
114
121
  cache_dir = cache_dir source_uri
data/lib/rubygems/util.rb CHANGED
@@ -76,7 +76,9 @@ module Gem::Util
76
76
 
77
77
  ##
78
78
  # Globs for files matching +pattern+ inside of +directory+,
79
- # returning absolute paths to the matching files.
79
+ # returning absolute paths to the matching files. Unlike a plain
80
+ # Dir.glob with an interpolated path, glob metacharacters in
81
+ # +base_path+ are not treated as part of the pattern.
80
82
 
81
83
  def self.glob_files_in_dir(glob, base_path)
82
84
  Dir.glob(glob, base: base_path).map! {|f| File.expand_path(f, base_path) }
data/lib/rubygems.rb CHANGED
@@ -9,7 +9,7 @@
9
9
  require "rbconfig"
10
10
 
11
11
  module Gem
12
- VERSION = "4.0.16"
12
+ VERSION = "4.0.17"
13
13
  end
14
14
 
15
15
  require_relative "rubygems/defaults"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.16
4
+ version: 4.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -723,7 +723,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
723
723
  - !ruby/object:Gem::Version
724
724
  version: '0'
725
725
  requirements: []
726
- rubygems_version: 4.0.13
726
+ rubygems_version: 4.0.16
727
727
  specification_version: 4
728
728
  summary: RubyGems is a package management framework for Ruby. This gem is downloaded
729
729
  and installed by `gem update --system`, so that the `gem` CLI can update itself.