mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
68a5b0f086
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 |
||
---|---|---|
.. | ||
commands | ||
core_ext | ||
ext | ||
optparse | ||
package | ||
request | ||
request_set | ||
resolver | ||
security | ||
source | ||
ssl_certs | ||
tsort | ||
util | ||
available_set.rb | ||
basic_specification.rb | ||
bundler_version_finder.rb | ||
command.rb | ||
command_manager.rb | ||
compatibility.rb | ||
config_file.rb | ||
defaults.rb | ||
dependency.rb | ||
dependency_installer.rb | ||
dependency_list.rb | ||
deprecate.rb | ||
doctor.rb | ||
errors.rb | ||
exceptions.rb | ||
ext.rb | ||
gem_runner.rb | ||
gemcutter_utilities.rb | ||
indexer.rb | ||
install_default_message.rb | ||
install_message.rb | ||
install_update_options.rb | ||
installer.rb | ||
installer_uninstaller_utils.rb | ||
local_remote_options.rb | ||
mock_gem_ui.rb | ||
name_tuple.rb | ||
openssl.rb | ||
optparse.rb | ||
package.rb | ||
package_task.rb | ||
path_support.rb | ||
platform.rb | ||
psych_tree.rb | ||
query_utils.rb | ||
rdoc.rb | ||
remote_fetcher.rb | ||
request.rb | ||
request_set.rb | ||
requirement.rb | ||
resolver.rb | ||
s3_uri_signer.rb | ||
safe_yaml.rb | ||
security.rb | ||
security_option.rb | ||
source.rb | ||
source_list.rb | ||
spec_fetcher.rb | ||
specification.rb | ||
specification_policy.rb | ||
stub_specification.rb | ||
text.rb | ||
tsort.rb | ||
uninstaller.rb | ||
unknown_command_spell_checker.rb | ||
uri.rb | ||
uri_formatter.rb | ||
user_interaction.rb | ||
util.rb | ||
validator.rb | ||
version.rb | ||
version_option.rb |