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,9 +17,14 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|||
|
||||
readme_file = File.join(@tempdir, 'README.md')
|
||||
|
||||
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|
|
||||
s.license = 'AGPL-3.0'
|
||||
|
|
|
@ -2200,7 +2200,7 @@ gem 'other', version
|
|||
end
|
||||
|
||||
def mask
|
||||
0100755 & (~File.umask)
|
||||
0100755
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -3823,6 +3823,8 @@ end
|
|||
FileUtils.mkdir_p "test"
|
||||
FileUtils.mkdir_p "bin"
|
||||
|
||||
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")
|
||||
|
@ -3830,6 +3832,9 @@ end
|
|||
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