diff options
author | Koichi Sasada <[email protected]> | 2024-06-12 10:27:25 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2024-06-12 14:06:42 +0900 |
commit | 39c9d99f6ccb81479c077e5cf1623572ade226a1 (patch) | |
tree | db976b6afbdf0bc7cf653ce47087c9fe846375ab | |
parent | 206465e84d7c258194b8e682d794a95e8416ff3b (diff) |
'SPEC_TEMP_DIR` should not be world-writable
`SPEC_TEMP_DIR` is not present until `tmp()` method is called
on parallel run. In this case `tmp()` is called with `File.umask = 0`.
This patch makes `SPEC_TEMP_DIR` before `File.umask = 0`.
To solve the issue essentially, I think `SPEC_TEMP_DIR` should be
prepared at the beginning of parallel process.
-rw-r--r-- | spec/ruby/library/find/fixtures/common.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/ruby/library/find/fixtures/common.rb b/spec/ruby/library/find/fixtures/common.rb index 14a7edb09a..99f3bbb45a 100644 --- a/spec/ruby/library/find/fixtures/common.rb +++ b/spec/ruby/library/find/fixtures/common.rb @@ -71,13 +71,17 @@ module FindDirSpecs end def self.create_mock_dirs + tmp('') # make sure there is an tmpdir umask = File.umask 0 - mock_dir_files.each do |name| - file = File.join mock_dir, name - mkdir_p File.dirname(file) - touch file + begin + mock_dir_files.each do |name| + file = File.join mock_dir, name + mkdir_p File.dirname(file) + touch file + end + ensure + File.umask umask end - File.umask umask end def self.delete_mock_dirs |