diff options
author | Martin Emde <martin.emde@gmail.com> | 2023-12-17 13:22:38 -0800 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-01-24 13:50:16 +0900 |
commit | 01f9766aa05182a7bbdc914a5dcd8a36ebade861 (patch) | |
tree | a93628420b1a39603f4be3bb31b83a45feb09d22 /test/rubygems/test_gem.rb | |
parent | 2defa9f4ae52c99e64a02b7f78362fbd788a1fd0 (diff) |
Ensure File.open applies default umask on gem extract
Diffstat (limited to 'test/rubygems/test_gem.rb')
-rw-r--r-- | test/rubygems/test_gem.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index d4c307978e..8dc8563aaf 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -161,13 +161,17 @@ class TestGem < Gem::TestCase format_executable: format_executable, } Dir.chdir @tempdir do + # use chmod to set global permissions (so umask doesn't bypass our choice) to ensure they are masked on install Dir.mkdir "bin" + File.chmod 0o777, "bin" Dir.mkdir "data" + File.chmod 0o777, "data" File.write "bin/foo", "#!/usr/bin/env ruby\n" - File.chmod 0o755, "bin/foo" + File.chmod 0o777, "bin/foo" File.write "data/foo.txt", "blah\n" + File.chmod 0o666, "data/foo.txt" spec_fetcher do |f| f.gem "foo", 1 do |s| @@ -180,7 +184,7 @@ class TestGem < Gem::TestCase prog_mode = (options[:prog_mode] & mask).to_s(8) dir_mode = (options[:dir_mode] & mask).to_s(8) - data_mode = (options[:data_mode] & mask).to_s(8) + data_mode = (options[:data_mode] & mask & (~File.umask)).to_s(8) prog_name = "foo" prog_name = RbConfig::CONFIG["ruby_install_name"].sub("ruby", "foo") if options[:format_executable] expected = { |