Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem?
fixes #357 Incorrect file permissions for ccache file
What's the solution?
When file is created it will have some default permissions on Unix. Depending on system configuration that can allow read access to anybody.
Describe the solution here.
There is no standard way how to set Unix permissions on
File
class - specialty when targeting Framework (not really applicable) or .NET Standard. .NET Core 7.0 introduced method to set permissions (essentiallychmod
) and this PR tries to use it on Unix via Reflection.I was wondering where to put it @SteveSyfuhs and I put it to base file class instead of just the ccache. If there are files that should be readable or writable by others that may be the wrong place. The code also tries to create directory if needed and I'm not sure if we should be explicit there is well in case we end up creating it. (that is different from the example in /tmp where we should not touch the permissions)
I'm not sure how to construct Unix specific test and how to verify the functionality in portable way. If you have sgesstions please let me know.
What issue is this related to, if any?
#357