Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check SPEC_TEMP_DIR is world-writable or not #10961

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

ko1
Copy link
Contributor

@ko1 ko1 commented Jun 11, 2024

1)
Dir.mktmpdir when passed a block yields the path to the passed block ERROR
ArgumentError: parent directory is world writable but not sticky: /tmp/rubytest.wlu5cs_11
/tmp/ruby/src/trunk/lib/tmpdir.rb:113:in 'Dir.mktmpdir'
/tmp/ruby/src/trunk/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb:39:in 'block (2 levels) in <top (required)>'

This weird error comes from world-writable (and not sticky) directory of SPEC_TEMP_DIR.

This patch checks SPEC_TEMP_DIR is not world-writable if exists and File.umask contains o+w mask.

```
1)
Dir.mktmpdir when passed a block yields the path to the passed block ERROR
ArgumentError: parent directory is world writable but not sticky: /tmp/rubytest.wlu5cs_11
/tmp/ruby/src/trunk/lib/tmpdir.rb:113:in 'Dir.mktmpdir'
/tmp/ruby/src/trunk/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb:39:in 'block (2 levels) in <top (required)>'
```

This weird error comes from world-writable (and not sticky) directory
of `SPEC_TEMP_DIR`.

This patch checks `SPEC_TEMP_DIR` is not world-writable if exists
and `File.umask` contains o+w mask.
@ko1 ko1 enabled auto-merge (rebase) June 11, 2024 07:18
@ko1 ko1 merged commit 6086bae into ruby:master Jun 11, 2024
104 of 105 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant