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

Change default umask from 777 to 027 #22589

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

fluiddot
Copy link
Contributor

@fluiddot fluiddot commented Sep 19, 2024

Addresses #17269.

This PR follows the approach made in #17270, but also includes a unit test to cover umask functionality.

test/test_core.py Outdated Show resolved Hide resolved
test/stat/test_umask.c Outdated Show resolved Hide resolved
test/stat/test_umask.c Outdated Show resolved Hide resolved
@fluiddot
Copy link
Contributor Author

Thanks @sbc100 for taking a look at the PR 🙇 ! It's my first attempt to add unit tests to the repository, so bear with me for any mistakes 😅 .

@sbc100
Copy link
Collaborator

sbc100 commented Sep 19, 2024

Thanks @sbc100 for taking a look at the PR 🙇 ! It's my first attempt to add unit tests to the repository, so bear with me for any mistakes 😅 .

Thanks for your contribution! Much appreciated.

@fluiddot
Copy link
Contributor Author

Btw, I picked the value 027 following #17270, but maybe we should consider a more permissive approach using 022. Looks like on many UNIX systems, 022 is the default value. WDYT?

}

int main() {
signal(SIGABRT, cleanup);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this line, along with the cleanup function?


int main() {
signal(SIGABRT, cleanup);
test();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I guess you might as well inline the test into main since that is all it contains now.

@also_with_wasmfs
def test_umask(self):
self.set_setting("FORCE_FILESYSTEM")
self.do_runf('stat/test_umask.c', 'success')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this test into test/other? And then use do_other_test to run it? You can run it with --rebase to generate the expected output.

// Get the default umask
mode_t default_umask = get_umask();
printf("default umask: %o\n", default_umask);
assert(default_umask == 027);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think making the default 022 makes sense yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants