2021Q1 rubygems deprecation warnings

With the new ports quarterly we see this kind of deprecation warnings when installing ruby gems (either via ports tree or with the gem command):
/usr/local/lib/ruby/site_ruby/2.7/rubygems/package.rb:509: warning: Using the last argument as keyword parameters is deprecated

While probably being harmless in itself, this points to something that is not well maintained.

Since ruby 2.x the gem tool is contained in the ruby software, and need no longer be separately installed. But we still have a separate port for the gem tool: devel/ruby-gems. And we need to install this because it provides the gem executable, and all the gems in the ports tree depend on it.

As every ruby software has their own gem tool included, each has it's own version of it:
lang/ruby25: 2.7.6.2
lang/ruby26: 3.0.3
lang/ruby27: 3.1.4
but:
devel/ruby-gems: 3.0.8

So we see the problem: the gem tool from ports is downlevel against the gem tool as of ruby27.
The funny thing: all the ruby versions will use their embedded gem tool anyway, only the current default ruby version will use the extra gem tool. And the default ruby version has been changed to 2.7 with the new quarterly - so that is why these deprecation messages do suddenly appear.

The question: why do we have that extra gem tool at all? I might think it should be removed, and all ruby versions should consistently use their own embedded gem tool. This would be less prone to surprizes when switching the default, also.
But this would need to fix up all ruby versions to install their own gem binary, and all rubygem-* packages to no longer depend on devel/ruby-gems.

So, for now I decided to just empty out the devel/ruby-gems port - it does now no longer install itself, but consist only of the gem executable. This works and appears to be the most practical and simple approach:

Code:
$ pkg list ruby27-gems
/usr/local/bin/gem
/usr/local/bin/gem27

The Patch for /usr/ports as of 2021Q1:

Code:
Index: devel/ruby-gems/pkg-plist
===================================================================
--- devel/ruby-gems/pkg-plist    (revision 560264)
+++ devel/ruby-gems/pkg-plist    (working copy)
@@ -1,192 +1,5 @@
bin/gem
bin/gem%%RUBY_VER_SHORT%%
-%%RUBY_SITELIBDIR%%/rubygems.rb
-%%RUBY_SITELIBDIR%%/rubygems/available_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/basic_specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/bundler_version_finder.rb
-%%RUBY_SITELIBDIR%%/rubygems/command.rb
-%%RUBY_SITELIBDIR%%/rubygems/command_manager.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/build_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/cert_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/check_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/cleanup_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/contents_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/dependency_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/environment_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/fetch_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/generate_index_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/help_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/info_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/install_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/list_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/lock_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/mirror_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/open_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/outdated_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/owner_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/pristine_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/push_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/query_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/rdoc_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/search_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/server_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/setup_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/signin_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/signout_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/sources_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/specification_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/stale_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/uninstall_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/unpack_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/update_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/which_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/commands/yank_command.rb
-%%RUBY_SITELIBDIR%%/rubygems/compatibility.rb
-%%RUBY_SITELIBDIR%%/rubygems/config_file.rb
-%%RUBY_SITELIBDIR%%/rubygems/core_ext/kernel_gem.rb
-%%RUBY_SITELIBDIR%%/rubygems/core_ext/kernel_require.rb
-%%RUBY_SITELIBDIR%%/rubygems/core_ext/kernel_warn.rb
-%%RUBY_SITELIBDIR%%/rubygems/defaults.rb
-%%RUBY_SITELIBDIR%%/rubygems/dependency.rb
-%%RUBY_SITELIBDIR%%/rubygems/dependency_installer.rb
-%%RUBY_SITELIBDIR%%/rubygems/dependency_list.rb
-%%RUBY_SITELIBDIR%%/rubygems/deprecate.rb
-%%RUBY_SITELIBDIR%%/rubygems/doctor.rb
-%%RUBY_SITELIBDIR%%/rubygems/errors.rb
-%%RUBY_SITELIBDIR%%/rubygems/exceptions.rb
-%%RUBY_SITELIBDIR%%/rubygems/ext.rb
-%%RUBY_SITELIBDIR%%/rubygems/ext/build_error.rb
-%%RUBY_SITELIBDIR%%/rubygems/ext/builder.rb
-%%RUBY_SITELIBDIR%%/rubygems/ext/cmake_builder.rb
-%%RUBY_SITELIBDIR%%/rubygems/ext/configure_builder.rb
-%%RUBY_SITELIBDIR%%/rubygems/ext/ext_conf_builder.rb
-%%RUBY_SITELIBDIR%%/rubygems/ext/rake_builder.rb
-%%RUBY_SITELIBDIR%%/rubygems/gem_runner.rb
-%%RUBY_SITELIBDIR%%/rubygems/gemcutter_utilities.rb
-%%RUBY_SITELIBDIR%%/rubygems/indexer.rb
-%%RUBY_SITELIBDIR%%/rubygems/install_default_message.rb
-%%RUBY_SITELIBDIR%%/rubygems/install_message.rb
-%%RUBY_SITELIBDIR%%/rubygems/install_update_options.rb
-%%RUBY_SITELIBDIR%%/rubygems/installer.rb
-%%RUBY_SITELIBDIR%%/rubygems/installer_test_case.rb
-%%RUBY_SITELIBDIR%%/rubygems/local_remote_options.rb
-%%RUBY_SITELIBDIR%%/rubygems/mock_gem_ui.rb
-%%RUBY_SITELIBDIR%%/rubygems/name_tuple.rb
-%%RUBY_SITELIBDIR%%/rubygems/package.rb
-%%RUBY_SITELIBDIR%%/rubygems/package/digest_io.rb
-%%RUBY_SITELIBDIR%%/rubygems/package/file_source.rb
-%%RUBY_SITELIBDIR%%/rubygems/package/io_source.rb
-%%RUBY_SITELIBDIR%%/rubygems/package/old.rb
-%%RUBY_SITELIBDIR%%/rubygems/package/source.rb
-%%RUBY_SITELIBDIR%%/rubygems/package/tar_header.rb
-%%RUBY_SITELIBDIR%%/rubygems/package/tar_reader.rb
-%%RUBY_SITELIBDIR%%/rubygems/package/tar_reader/entry.rb
-%%RUBY_SITELIBDIR%%/rubygems/package/tar_test_case.rb
-%%RUBY_SITELIBDIR%%/rubygems/package/tar_writer.rb
-%%RUBY_SITELIBDIR%%/rubygems/package_task.rb
-%%RUBY_SITELIBDIR%%/rubygems/path_support.rb
-%%RUBY_SITELIBDIR%%/rubygems/platform.rb
-%%RUBY_SITELIBDIR%%/rubygems/psych_additions.rb
-%%RUBY_SITELIBDIR%%/rubygems/psych_tree.rb
-%%RUBY_SITELIBDIR%%/rubygems/rdoc.rb
-%%RUBY_SITELIBDIR%%/rubygems/remote_fetcher.rb
-%%RUBY_SITELIBDIR%%/rubygems/request.rb
-%%RUBY_SITELIBDIR%%/rubygems/request/connection_pools.rb
-%%RUBY_SITELIBDIR%%/rubygems/request/http_pool.rb
-%%RUBY_SITELIBDIR%%/rubygems/request/https_pool.rb
-%%RUBY_SITELIBDIR%%/rubygems/request_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/request_set/gem_dependency_api.rb
-%%RUBY_SITELIBDIR%%/rubygems/request_set/lockfile.rb
-%%RUBY_SITELIBDIR%%/rubygems/request_set/lockfile/parser.rb
-%%RUBY_SITELIBDIR%%/rubygems/request_set/lockfile/tokenizer.rb
-%%RUBY_SITELIBDIR%%/rubygems/requirement.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/activation_request.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/api_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/api_specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/best_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/composed_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/conflict.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/current_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/dependency_request.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/git_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/git_specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/index_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/index_specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/installed_specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/installer_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/local_specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/lock_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/lock_specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/errors.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/resolution.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/resolver.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/molinillo/lib/molinillo/state.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/requirement_list.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/set.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/source_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/spec_specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/stats.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/vendor_set.rb
-%%RUBY_SITELIBDIR%%/rubygems/resolver/vendor_specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/s3_uri_signer.rb
-%%RUBY_SITELIBDIR%%/rubygems/safe_yaml.rb
-%%RUBY_SITELIBDIR%%/rubygems/security.rb
-%%RUBY_SITELIBDIR%%/rubygems/security/policies.rb
-%%RUBY_SITELIBDIR%%/rubygems/security/policy.rb
-%%RUBY_SITELIBDIR%%/rubygems/security/signer.rb
-%%RUBY_SITELIBDIR%%/rubygems/security/trust_dir.rb
-%%RUBY_SITELIBDIR%%/rubygems/security_option.rb
-%%RUBY_SITELIBDIR%%/rubygems/server.rb
-%%RUBY_SITELIBDIR%%/rubygems/source.rb
-%%RUBY_SITELIBDIR%%/rubygems/source/git.rb
-%%RUBY_SITELIBDIR%%/rubygems/source/installed.rb
-%%RUBY_SITELIBDIR%%/rubygems/source/local.rb
-%%RUBY_SITELIBDIR%%/rubygems/source/lock.rb
-%%RUBY_SITELIBDIR%%/rubygems/source/specific_file.rb
-%%RUBY_SITELIBDIR%%/rubygems/source/vendor.rb
-%%RUBY_SITELIBDIR%%/rubygems/source_list.rb
-%%RUBY_SITELIBDIR%%/rubygems/source_local.rb
-%%RUBY_SITELIBDIR%%/rubygems/source_specific_file.rb
-%%RUBY_SITELIBDIR%%/rubygems/spec_fetcher.rb
-%%RUBY_SITELIBDIR%%/rubygems/specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/specification_policy.rb
-%%RUBY_SITELIBDIR%%/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem
-%%RUBY_SITELIBDIR%%/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem
-%%RUBY_SITELIBDIR%%/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem
-%%RUBY_SITELIBDIR%%/rubygems/stub_specification.rb
-%%RUBY_SITELIBDIR%%/rubygems/syck_hack.rb
-%%RUBY_SITELIBDIR%%/rubygems/test_case.rb
-%%RUBY_SITELIBDIR%%/rubygems/test_utilities.rb
-%%RUBY_SITELIBDIR%%/rubygems/text.rb
-%%RUBY_SITELIBDIR%%/rubygems/uninstaller.rb
-%%RUBY_SITELIBDIR%%/rubygems/uri_formatter.rb
-%%RUBY_SITELIBDIR%%/rubygems/user_interaction.rb
-%%RUBY_SITELIBDIR%%/rubygems/util.rb
-%%RUBY_SITELIBDIR%%/rubygems/util/licenses.rb
-%%RUBY_SITELIBDIR%%/rubygems/util/list.rb
-%%RUBY_SITELIBDIR%%/rubygems/validator.rb
-%%RUBY_SITELIBDIR%%/rubygems/version.rb
-%%RUBY_SITELIBDIR%%/rubygems/version_option.rb
-%%RUBY_SITELIBDIR%%/ubygems.rb
@dir lib/ruby/gems/%%RUBY_VER%%/build_info
@dir %%EXT_DIR%%
@dir %%CACHE_DIR%%
Index: devel/ruby-gems/Makefile
===================================================================
--- devel/ruby-gems/Makefile    (revision 560264)
+++ devel/ruby-gems/Makefile    (working copy)
@@ -50,19 +50,11 @@
         SPEC_DIR="${SPEC_DIR}" \
         EXT_DIR="${EXT_DIR}"

-OPTIONS_DEFINE=    DOCS
+RUBY_SETUP_OPTIONS+=    --no-ri --no-rdoc

-DOCS_VARS_OFF=    RUBY_SETUP_OPTIONS+="--no-ri --no-rdoc"
-
do-install:
     ${MKDIR} ${STAGEDIR}${PREFIX}/${GEMS_VER_DIR}
     cd ${WRKSRC}/ && ${SETENV} ${GEMS_ENV} ${RUBY} ${RUBY_SETUP} ${RUBY_SETUP_OPTIONS}
     ${LN} -sf gem${RUBY_VER_SHORT} ${STAGEDIR}${PREFIX}/bin/gem

-#
-# Find all RDOC and RI files
-#
-post-install-DOCS-on:
-    cd ${STAGEDIR}${PREFIX}/ && ${FIND} -ds ${GEMS_DOC_DIR}/ ! -type d >> ${TMPPLIST}
-
.include <bsd.port.mk>

The details for the records (so I can find them again).
 
Last edited:
Hello PMc!

I'm one upstream maintainer of bundler & rubygems.

We've been getting some reports about these warnings from freebsd users, and I found this post which very accurately describes the problem. As a matter of fact, we recently forbid downgrading rubygems to versions older than the one included with each upstream ruby. So technically one should never run rubygems older than 3.1.4 on ruby2.7.

Are you planning to contribute your changes to freebsd, so that this problem can be fixed?

Thanks! ?
 
Hi hombre,

that's cool indeed! Quite a while ago, that is, a few hundred other bugs hit me in the meantime.

I'm one upstream maintainer of bundler & rubygems.
Ah, the non-working bundler. Bundler did break with version 1.1.6; it started to fail with Errno=30 (EROFS - and who would want a writeable filesystem for the executables on a publicly accessable server?) - and I had a hard time trying to get that fixed, to no success: there is just no way to reach anybody in charge on the ivory-tower.

Finally with 2.2.x the issue disappeared - not because it would have been fixed, but because the respective code path seems no longer being traversed.

We've been getting some reports about these warnings from freebsd users, and I found this post which very accurately describes the problem. As a matter of fact, we recently forbid downgrading rubygems to versions older than the one included with each upstream ruby. So technically one should never run rubygems older than 3.1.4 on ruby2.7.
Ah, thats another possibility that I didn't think of. Wondering how you would achieve this - I don't see a respective change in the portstree (neither can imagine how that would look like).

There is probably a couple of ways to solve the issue, and the question is which one is feasible (basically the whole concept of piggybacking one package manager onto another is a bit ugly, but unavoidable). E.g.
  • the devel/ruby-gems should be able to patch-up itself via gem update --system. This somehow fails due to bundler, for whatever reason. It also would destroy the port's checksums, so probably unfeasible.
  • one could get rid of the whole devel/ruby-gems and have the lang/rubyXX ports install a gemXX command just like they install rubyXX. Would need to edit the Makefile of all rubygems ports to not depend on devel/ruby-gems. Not practical for a site-local patch, but possibly upstream.
Are you planning to contribute your changes to freebsd, so that this problem can be fixed?
I don't think I have the req'd Kalothi to deal with such.

Basically I just want my software to run. That implies hitting (and fixing) 1-2 bugs per day.
If I would try to "contribute" anything, then that would imply to do all the necessary small-talk and networking to arrange with those on the ivory-tower, which would take a couple of days for every bug (and probably to no avail) - so I would just not be able to keep up the rate.
 
Back
Top