Skip to content

Set file permissions in DirectoryStorage according to umask #445

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

Closed

Conversation

eddienko
Copy link

@eddienko eddienko commented Jun 26, 2019

Fixes #325

This is my take on having DirectoryStorage play nice with the local defined umask.

@pep8speaks
Copy link

pep8speaks commented Jun 26, 2019

Hello @eddienko! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-07-22 09:02:17 UTC

@eddienko eddienko force-pushed the directory-structure-umask branch from 97499be to 6d49909 Compare July 3, 2019 21:12
@eddienko eddienko force-pushed the directory-structure-umask branch from 6d49909 to 74e063b Compare July 22, 2019 09:02
@eddienko
Copy link
Author

@manolinux I cannot reproduce the error that you are seeing - my understanding is that if you are the owner of a file you can chmod it. Could you add more info about the permissions that you have in those directories or a simple script that replicates the problem?

@manolinux
Copy link

manolinux commented Jul 29, 2019 via email

@eddienko
Copy link
Author

Sorry but I tried lots of combinations with different group permissions and users and still cannot reproduce. If anyone can provide a test where this fails I am happy to have a look at it.

@manolinux
Copy link

Hi, don't worry anymore about this.

The problem is my configuration of shared CIFS filesystem that maps users to a uid,gid distinct than current user, that's why tempfile.NamedTemporaryFile is unable to chmod.

I have to keep my tempfile._mkstemp_inner patching for going on with Zarr, but your code has then nothing to do with the issue.

Sorry for the inconvenience, and thanks a lot for your support!
Manuel.

@d-v-b
Copy link
Contributor

d-v-b commented Sep 29, 2019

@jrbourbeau Is there anything blocking this PR? Our group would really love to see this merged, we've had a lot of permissions-related headaches stemming from this issue.

@manolinux
Copy link

manolinux commented Sep 30, 2019 via email

@jrbourbeau
Copy link
Member

jrbourbeau commented Oct 1, 2019

Apologies for the delayed response @d-v-b. I'm not a Zarr maintainer, so I don't control which PRs are merged. Others like @jakirkham and @alimanfoo are more equipped to review the changes in this PR (although please keep in mind they may have very limited bandwidth right now)

That said, it looks like in the original issue, it was proposed that we could move away from using temporary files here to resolve permissions issues while avoiding the need to query the current umask and then chmod (xref #325 (comment) and #325 (comment)). Not sure if that approach that should be taken here, or if the current changes in this PR are generally okay.

@d-v-b
Copy link
Contributor

d-v-b commented Oct 2, 2019

@jrbourbeau Thanks for the update, sorry for putting any pressure on you.

It would be great to hear from maintainers in this thread. From my perspective, I would consider the current behavior (generating files with permissions not specified by the umask, then forcing users to manually chmod after creating containers) a bug and thus prioritize fixing that before developing the more elegant solution that avoids the temporary files.

@d-v-b
Copy link
Contributor

d-v-b commented Oct 4, 2019

For me, this PR does not fix permissions problems for attributes.json files when using N5Store. I'll see where that comes from.

@eddienko
Copy link
Author

eddienko commented Oct 5, 2019

Hi,

I generally agree that this should be considered a bug and should be fixed prior to having a more general solution if there is any. Only thing however is to check that it does not break anything else, though I guess tests should do that.

@d-v-b for me this works fine as well with N5Store:

import zarr
store = zarr.N5Store('/tmp/array.n5')
z = zarr.zeros((10, 10), chunks=(5, 5), store=store, overwrite=True)
z[:] = 42

and

$ umask
022
$ ls -la array.n5
total 8
drwxr-xr-x   5 user  wheel  160  5 Oct 07:35 .
drwxrwxrwt  17 root   wheel  544  5 Oct 07:35 ..
drwxr-xr-x   4 user  wheel  128  5 Oct 07:35 0
drwxr-xr-x   4 user  wheel  128  5 Oct 07:35 1
-rw-r--r--   1 user  wheel  244  5 Oct 07:35 attributes.json

@jakirkham
Copy link
Member

It sounds like this is addressed with PR ( #493 ). Would you agree @eddienko? If so, happy to close?

@eddienko eddienko closed this Oct 28, 2019
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.

Set file permissions accoding to umask
6 participants