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

reflink: set mode to 0o666 #248

Merged
merged 1 commit into from
Dec 6, 2023
Merged

reflink: set mode to 0o666 #248

merged 1 commit into from
Dec 6, 2023

Conversation

skshetry
Copy link
Member

@skshetry skshetry commented Dec 6, 2023

So that at least executable bit does not get set. Still leaves a security related question, but that issue was already there before.

@@ -91,7 +91,7 @@ def reflink(src, dst):
src_fd = os.open(src, os.O_RDONLY)

try:
dst_fd = os.open(dst, os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
dst_fd = os.open(dst, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o666)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dst_fd = os.open(dst, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o666)
dst_fd = os.open(dst, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o666 & ~umask)

this would be the proper way, strictly speaking

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't os.open doing that? Let me take a look.

Copy link
Member Author

@skshetry skshetry Dec 6, 2023

Choose a reason for hiding this comment

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

Docs says:

Open the file path and set various flags according to flags and possibly its mode according to mode. When computing mode, the current umask value is first masked out

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad, mixed things up.

@efiop efiop merged commit 5b3775c into main Dec 6, 2023
13 checks passed
@skshetry skshetry deleted the reflink-mode branch December 6, 2023 16:13
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