adaptive icon indicating copy to clipboard operation
adaptive copied to clipboard

learner.save creates file with different permissions than open().write

Open basnijholt opened this issue 5 years ago • 0 comments
trafficstars

This is annoying when one uses a shared file system, where all other files that are written (with default settings) will be readable by other users but files that are saved with Adaptive are not.

In Adaptive this happens because of atomicwrites, code example:

from atomicwrites import AtomicWriter

with open("test_open", "w") as f:
    f.write("hi")

with AtomicWriter("test_adaptive", "wb", overwrite=True).open() as f:
    f.write(b"blob")

gives

$ ls -lah test*
-rw-------. 1 a-banijh a-banijh 4 Jun  2 08:33 test_adaptive
-rw-rw-r--. 1 a-banijh a-banijh 2 Jun  2 08:33 test_open

Maybe relevant:

  • https://github.com/untitaker/python-atomicwrites/issues/42
  • https://github.com/untitaker/python-atomicwrites/pull/11

Tagging @georgwinkler @jbweston

basnijholt avatar Jun 02 '20 08:06 basnijholt