mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Make the test suite pass under umask 077
Some tests had failed under `umask 077` mode. As far as I investigated, there is no actual bug. All failures were caused by tests that create a wrong-permission file or expect wrong permission. This changeset fixes the tests. https://github.com/rubygems/rubygems/commit/078213e527
This commit is contained in:
parent
de58dfc911
commit
2c2b0d4ec1
3 changed files with 18 additions and 8 deletions
|
@ -17,8 +17,13 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|||
|
||||
readme_file = File.join(@tempdir, 'README.md')
|
||||
|
||||
File.open readme_file, 'w' do |f|
|
||||
f.write 'My awesome gem'
|
||||
begin
|
||||
umask_orig = File.umask(2)
|
||||
File.open readme_file, 'w' do |f|
|
||||
f.write 'My awesome gem'
|
||||
end
|
||||
ensure
|
||||
File.umask(umask_orig)
|
||||
end
|
||||
|
||||
@gem = util_spec 'some_gem' do |s|
|
||||
|
|
|
@ -2200,7 +2200,7 @@ gem 'other', version
|
|||
end
|
||||
|
||||
def mask
|
||||
0100755 & (~File.umask)
|
||||
0100755
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -3823,12 +3823,17 @@ end
|
|||
FileUtils.mkdir_p "test"
|
||||
FileUtils.mkdir_p "bin"
|
||||
|
||||
FileUtils.touch File.join("ext", "a", "extconf.rb")
|
||||
FileUtils.touch File.join("lib", "code.rb")
|
||||
FileUtils.touch File.join("test", "suite.rb")
|
||||
begin
|
||||
umask_orig = File.umask(2)
|
||||
FileUtils.touch File.join("ext", "a", "extconf.rb")
|
||||
FileUtils.touch File.join("lib", "code.rb")
|
||||
FileUtils.touch File.join("test", "suite.rb")
|
||||
|
||||
File.open "bin/exec", "w", 0755 do |fp|
|
||||
fp.puts "#!#{Gem.ruby}"
|
||||
File.open "bin/exec", "w", 0755 do |fp|
|
||||
fp.puts "#!#{Gem.ruby}"
|
||||
end
|
||||
ensure
|
||||
File.umask(umask_orig)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue