sync_tree sometimes fails to copy the read-only attribute on Windows
Open
@leocardao is already working on this.
Since Jul 5, 2024.
- Dominant language
- Python
- Stars
- 32
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
In some cases, e3.fs.sync_tree fails to synchronize the Windows read-only attribute on files. You can reproduce the problem using the following script:
from e3.fs import sync_tree
from e3.os.fs import chmod
chmod("a-wx", "in/foo.txt")
sync_tree("in", "out", delete=True)
(It doesn't seem to matter whether delete is True or False.)
This is how I used the script:
poeplau@PAWNEE ~/code/sync_tree
$ mkdir in out
poeplau@PAWNEE ~/code/sync_tree
$ touch {in,out}/foo.txt
poeplau@PAWNEE ~/code/sync_tree
$ ll in out
in:
total 0
drwxrwxr-x+ 1 poeplau None 0 Feb 13 12:14 .
drwxrwxr-x+ 1 poeplau None 0 Feb 13 12:14 ..
-rw-rw-r--+ 1 poeplau None 0 Feb 13 12:14 foo.txt
out:
total 0
drwxrwxr-x+ 1 poeplau None 0 Feb 13 12:14 .
drwxrwxr-x+ 1 poeplau None 0 Feb 13 12:14 ..
-rw-rw-r--+ 1 poeplau None 0 Feb 13 12:14 foo.txt
poeplau@PAWNEE ~/code/sync_tree
$ python sync_tree_test.py
poeplau@PAWNEE ~/code/sync_tree
$ ll in out
in:
total 0
drwxrwxr-x+ 1 poeplau None 0 Feb 13 12:14 .
drwxrwxr-x+ 1 poeplau None 0 Feb 13 12:14 ..
-r--r--r--+ 1 poeplau None 0 Feb 13 12:14 foo.txt
out:
total 0
drwxrwxr-x+ 1 poeplau None 0 Feb 13 12:14 .
drwxrwxr-x+ 1 poeplau None 0 Feb 13 12:14 ..
-rw-rw-r--+ 1 poeplau None 0 Feb 13 12:14 foo.txt
Note how out/foo.txt is still writable after the call to sync_tree. Windows Explorer confirms that the read-only attribute isn't set.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.