Skip to content

[🐛 Bug]: rubyzip usage not compatible with rubyzip 3.x #10706

@robotfelix

Description

@robotfelix

What happened?

I haven't actually verified this bug myself, but a recent bundle install gave the following warning:

Post-install message from rubyzip:
RubyZip 3.0 is coming!
**********************

The public API of some Rubyzip classes has been modernized to use named
parameters for optional arguments. Please check your usage of the
following classes:
  * `Zip::File`
  * `Zip::Entry`
  * `Zip::InputStream`
  * `Zip::OutputStream`

Please ensure that your Gemfiles and .gemspecs are suitably restrictive
to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
See https://github.com/rubyzip/rubyzip for details. The Changelog also
lists other enhancements and bugfixes that have been implemented since
version 2.3.0.

I checked my Gemfile.lock and saw that selenium-webdriver was pulling in rubyzip as a dependency and was not locking the version of rubyzip as suggested by the message. The root definition of this dependency is here:

s.add_runtime_dependency 'rubyzip', ['>= 1.2.2']

I took the liberty at the code in this repo, and I think the only place that needs to be changed to handle rubyzip 3.x is for this line

Zip::File.open(zip_path, Zip::File::CREATE, &blk)

to be changed to

Zip::File.open(zip_path, create: true, &blk)

However I think this would break compatibility with rubyzip 1.x and 2.x. I'll leave it to you to decide whether to temporarily lock to the older version, drop support for older versions of rubyzip in some future release, or try to come up with a nice way to handle both!

How can we reproduce the issue?

I've not tested this because our Gemfile.lock already has rubyzip locked to 2.3.0, but
I think you could reproduce this right now as follows:

1. Create a fresh ruby project
2. Add `selenium-webdriver` to a Gemfile
3. Run `bundle install` which will pull in the latest versions of `selenium-webdriver` and `rubyzip`
4. Use some functionality that utilises the `zip` or `zip_file` methods of `Selenium::WebDriver::Zipper`

Relevant log output

N/A

Operating System

macOS

Selenium version

Ruby 4.1.0

What are the browser(s) and version(s) where you see this issue?

N/A

What are the browser driver(s) and version(s) where you see this issue?

N/A

Are you using Selenium Grid?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions