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

Preserve local metadata with cp_file. Fixes #1524 #1535

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Skylion007
Copy link
Contributor

Preserves permissions when copying local file. Fixes #1524

@Skylion007
Copy link
Contributor Author

@martindurant Is there a place I should add a regression test? I don't see any infra for doing that though for LocalFilesystem.

@Skylion007 Skylion007 changed the title Preserve Local cp_file metadata. Fixes #1524 Preserve local metadata with cp_file. Fixes #1524 Mar 5, 2024
@Skylion007 Skylion007 marked this pull request as draft March 5, 2024 16:50
@Skylion007
Copy link
Contributor Author

Actually, the more I think about this. The less sure I am about whether it should preserve this copied metadata by default. A lot of os system calls in Python do not... It wouldn't be add as a configuration option though...

@martindurant
Copy link
Member

Well... the default implementation for cp (like open(out).write(open(in).read()) ) transfers only data, since it is generic over al backends. I don't think any of the backend cp implementations explicitly transfer metadata, although it may be good to do an audit on this.

posix/bash's cp does not copy all access attributes:

$ chmod a+wrx TEMP
$ cp TEMP TEMP2
$ ll TEMP*
-rwxrwxrwx  1 mdurant  staff  1513  6 Mar 09:29 TEMP
-rwxr-xr-x  1 mdurant  staff  1513  6 Mar 09:29 TEMP2

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.

LocalFileSystem clobbers file permissions after cp_file
2 participants