Skip to content

Permissions of attributes.json file not matching umask #483

@d-v-b

Description

@d-v-b

When creating an N5 store via zarr on OSX or linux, the attributes.json file does not have permissions set by the user's umask and instead default to -rw-------. Additionally, whenever the array attrs are updated, the permissions of attributes.json are reverted to the unnecessarily restrictive default. This is unexpected and requires manually running chmod after array creation and whenever the attrs are changed. The expected behavior would be a) file permissions to be set according to the umask and b) file permissions not to change when a file is modified.

MRE (in ipython):

In [9]: !umask
022

In [10]: d = zarr.create(store=zarr.N5Store('test.n5'), path='test',shape=(10,10))
/Users/bennettd/miniconda3/lib/python3.7/site-packages/zarr/n5.py:416: RuntimeWarning: Not all N5 implementations support blosc compression (yet). You might not be able to open the dataset with another N5 library.
  RuntimeWarning

In [11]: !ls -lhv test.n5/test
total 8
-rw-------  1 bennettd  2115030055   246B Oct 13 16:05 attributes.json

In [12]: !chmod 777 test.n5/test/attributes.json

In [13]: !ls -lhv test.n5/test
total 8
-rwxrwxrwx  1 bennettd  2115030055   246B Oct 13 16:05 attributes.json

In [14]: d.attrs['test'] = 'test'

In [15]: !ls -lhv test.n5/test
total 8
-rw-------  1 bennettd  2115030055   266B Oct 13 16:07 attributes.json

See also: #325

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions