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

Decide how Backend.copy_file() should handle sub-paths as destinations #184

Open
hagenw opened this issue Feb 8, 2024 · 3 comments
Open

Comments

@hagenw
Copy link
Member

hagenw commented Feb 8, 2024

As discussed in #181 (comment) and #181 (comment) Backend.copy_file() might behave in unexpected ways.

First, we should add tests for it to each backend.
And then we should decide if we would like to stay with possible different behavior that is then documented in the corresponding docstrings of the backends, or if we should provide a standard behavior, e.g. raising an error if a sub-path is given in all backends.

@frankenjoe
Copy link
Collaborator

frankenjoe commented Feb 29, 2024

As the example in #181 (comment) shows this is actually a generic issue and not specifically related to Backend.copy_file().

EDIT: at least put_file() and move_file() are also affected.

@frankenjoe
Copy link
Collaborator

provide a standard behavior, e.g. raising an error if a sub-path is given in all backends.

Possible, but probably costly since it involves a call to call ls().

So maybe we leave it by adding to the documentation that a user must not put / copy / move a file to a sub-path of an existing file?

@hagenw
Copy link
Member Author

hagenw commented Feb 29, 2024

Yes, it seems indeed a good idea to avoid adding some additional operations that first checks what exists and what not.
So, indeed updating the documentation seems the way to go here.
I would maybe not write that a user must not use an existing sub-path as destination, but mention that in this case we do not guarantee a fixed behavior as it depends on the underlying backend and platform. And hence recommend to not use a sub-path as destination.

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

No branches or pull requests

2 participants