summaryrefslogtreecommitdiff
path: root/spec/bundler/bundler/source
diff options
context:
space:
mode:
authorJake Zimmerman <zimmerman.jake@gmail.com>2024-03-25 15:53:53 -0700
committergit <svn-admin@ruby-lang.org>2024-03-28 15:54:33 +0000
commit97b2cc34359968459a6eba2ac166f3650adf47be (patch)
treef0a1ca072924c844966fda2603677a476811976e /spec/bundler/bundler/source
parentfa0a62413ab9bdf72855a6614835174f50f29474 (diff)
Allow FormatError to take either String or Gem for source
Most of the calls to `FormatError.new` pass `@gem` for the second argument, which has a `path` method. But in one caseā€”on package.rb:691 in `verify_gz`, the `source` argument is a `String`. So if there's ever a GZip decode error when attempting to read the contents of the `data.tar.gz` file, instead of reporting the underlying GZip error (which might be something like "unexpected end of file"), we would report instead a NoMethodError coming from package.rb ``` Exception while verifying sorbet-0.5.11301.gem ERROR: While executing gem ... (NoMethodError) undefined method `path' for "data.tar.gz":String @path = source.path ^^^^^ ``` There are two ways to fix this: 1. Make `FormatError#initialize` aware of the fact that `source` might sometimes be a `String` 2. Make the call to `FormatError.new` in `verify_gz` pass `@gem` instead of `entry.full_name`. I've chosen 1 because I think it's more useful to see "unexpected end of file in data.tar.gz" instead of "unexpected end of file in sorbet-0.5.11301.gem." The end of file **is actually** in data.tar.gz, not in the gem file itself, which was decoded successfully.
Diffstat (limited to 'spec/bundler/bundler/source')
0 files changed, 0 insertions, 0 deletions