1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/rubygems
Kevin Newton 68a5b0f086 [rubygems/rubygems] Mask the file mode when extracting files
When extracting files from the tarball, a mode is retrieved from
the header. Occasionally you'll encounter a gem that was packaged
on a system whose permission bits result in a value that is larger
than the value that File.chmod will allow (anything >= 2^16). In
that case the extraction fails with a RangeError, which is pretty
esoteric.

If you extract the tarball with the tar and gunzip utilities, the
file permissions end up being just the bottom 16 bits masked off
from the original value. I've mirrored that behavior here. Per the
tar spec:

> Modes which are not supported by the operating system restoring
> files from the archive will be ignored.

I think that basically means what I've done here.

---

This commit also changes the behavior very slightly with regard to
when the chmod is called. Previously it was called while the file
descriptor was still open, but after the write call.

When write flushes, the file permissions are changed to the mode
value from the File.open call, undoing the changes made by
FileUtils.chmod. CRuby appears to flush the buffer after the
chmod call, whereas TruffleRuby flushes before the chmod call.
So the file permissions can change depending on implementation.
Both implementations end up getting the correct file permissions
for the bottom 9 bits (user, group, world), but differ with
regard to the sticky bit in the next 3.

To get consistent behavior, this commit changes it to close the
file descriptor before attempting to chmod anything, which makes
it consistent because the write flushes in both cases.

https://github.com/rubygems/rubygems/commit/22ce076e99
2022-09-15 14:49:20 +09:00
..
data Sync RubyGems & Bundler with upstream repo 2022-06-24 10:52:02 +09:00
fake_certlib
foo
package RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
packages [rubygems/rubygems] Mask the file mode when extracting files 2022-09-15 14:49:20 +09:00
plugin RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
rubygems/commands
sff
specifications RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_ext_cargo_builder [rubygems/rubygems] Bump rb-sys 2022-08-23 04:40:29 +09:00
alternate_cert.pem
alternate_cert_32.pem
alternate_key.pem
bad_rake.rb
ca_cert.pem
child_cert.pem
child_cert_32.pem
child_key.pem
client.pem
encrypted_private_key.pem
expired_cert.pem
future_cert.pem
future_cert_32.pem
good_rake.rb
grandchild_cert.pem
grandchild_cert_32.pem
grandchild_key.pem
helper.rb Merge 16c3535413 2022-09-05 14:37:12 +09:00
installer_test_case.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
invalid_client.pem
invalid_issuer_cert.pem
invalid_issuer_cert_32.pem
invalid_key.pem
invalid_signer_cert.pem
invalid_signer_cert_32.pem
invalidchild_cert.pem
invalidchild_cert_32.pem
invalidchild_key.pem
private3072_key.pem
private_ec_key.pem
private_key.pem
public3072_cert.pem
public_cert.pem
public_cert_32.pem
public_key.pem
rubygems_plugin.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
simple_gem.rb
ssl_cert.pem
ssl_key.pem
test_bundled_ca.rb Merge rubygems/bundler HEAD 2022-08-03 13:14:10 +09:00
test_config.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_deprecate.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_exit.rb [rubygems/rubygems] Use SystemExit#status as exit_code 2022-07-22 21:01:31 +09:00
test_gem.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_available_set.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_bundler_version_finder.rb Merge rubygems/bundler HEAD 2022-08-03 13:14:10 +09:00
test_gem_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_command_manager.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_build_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_cert_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_check_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_cleanup_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_contents_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_dependency_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_environment_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_fetch_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_generate_index_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_help_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_info_command.rb [rubygems/rubygems] Fix: Gem info bug with version flag 2022-09-07 06:18:58 +09:00
test_gem_commands_install_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_list_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_lock_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_mirror.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_open_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_outdated_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_owner_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_pristine_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_push_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_query_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_search_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_server_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_setup_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_signin_command.rb [rubygems/rubygems] Display mfa warnings on gem signin 2022-07-23 03:42:59 +09:00
test_gem_commands_signout_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_sources_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_specification_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_stale_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_uninstall_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_unpack_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_update_command.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_commands_which_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_commands_yank_command.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_config_file.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_dependency.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_dependency_installer.rb Merge rubygems/bundler HEAD. 2022-08-09 12:05:19 +09:00
test_gem_dependency_list.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_dependency_resolution_error.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_doctor.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_ext_builder.rb Merge rubygems/bundler HEAD 2022-08-03 13:14:10 +09:00
test_gem_ext_cargo_builder.rb Merge rubygems/bundler HEAD 2022-08-03 13:14:10 +09:00
test_gem_ext_cargo_builder_link_flag_converter.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_ext_cargo_builder_unit.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_ext_cmake_builder.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_ext_configure_builder.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_ext_ext_conf_builder.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_ext_rake_builder.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_gem_runner.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_gemcutter_utilities.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_impossible_dependencies_error.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_indexer.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_install_update_options.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_installer.rb Merge rubygems/bundler HEAD. 2022-08-09 12:05:19 +09:00
test_gem_local_remote_options.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_name_tuple.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_package.rb [rubygems/rubygems] Mask the file mode when extracting files 2022-09-15 14:49:20 +09:00
test_gem_package_old.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_package_tar_header.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_package_tar_reader.rb Merge rubygems/bundler HEAD. 2022-08-09 12:05:19 +09:00
test_gem_package_tar_reader_entry.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_package_tar_writer.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_package_task.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_path_support.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_platform.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_rdoc.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_remote_fetcher.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_request.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_request_connection_pools.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_request_set.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_request_set_gem_dependency_api.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_request_set_lockfile.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_request_set_lockfile_parser.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_request_set_lockfile_tokenizer.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_requirement.rb Merge rubygems/bundler HEAD 2022-08-03 13:14:10 +09:00
test_gem_resolver.rb [rubygems/rubygems] Fix resolution on non-musl platforms 2022-09-09 19:38:52 +09:00
test_gem_resolver_activation_request.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_api_set.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_resolver_api_specification.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_resolver_best_set.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_composed_set.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_conflict.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_dependency_request.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_git_set.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_git_specification.rb Merge rubygems/bundler HEAD 2022-08-03 13:14:10 +09:00
test_gem_resolver_index_set.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_index_specification.rb [rubygems/rubygems] fix platform matching for index specs 2022-08-03 06:56:36 +09:00
test_gem_resolver_installed_specification.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_installer_set.rb Merge rubygems/bundler HEAD. 2022-08-09 12:05:19 +09:00
test_gem_resolver_local_specification.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_lock_set.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_lock_specification.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_requirement_list.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_specification.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_vendor_set.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_resolver_vendor_specification.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_security.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_security_policy.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_security_signer.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_security_trust_dir.rb Merge rubygems/bundler HEAD 2022-08-03 13:14:10 +09:00
test_gem_silent_ui.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_source.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_source_fetch_problem.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_source_git.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_source_installed.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_source_list.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_source_local.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_source_lock.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_source_specific_file.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_source_subpath_problem.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_source_vendor.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_spec_fetcher.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_specification.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_stream_ui.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_stub_specification.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_text.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_uninstaller.rb Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
test_gem_unsatisfiable_dependency_error.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_uri.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_uri_formatter.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_util.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_validator.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_gem_version.rb [rubygems/rubygems] Warn (rather than crash) when setting nil specification versions 2022-08-03 06:56:18 +09:00
test_gem_version_option.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_kernel.rb Merge rubygems/bundler HEAD 2022-08-03 13:14:10 +09:00
test_project_sanity.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_remote_fetch_error.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
test_require.rb Merge rubygems/bundler HEAD. 2022-08-09 12:05:19 +09:00
test_rubygems.rb RubyGems: Enable Style/StringLiterals cop 2022-07-22 12:07:23 +09:00
utilities.rb Merge rubygems/bundler HEAD. 2022-08-09 12:05:19 +09:00
wrong_key_cert.pem
wrong_key_cert_32.pem