Skip to content

Copying files between filesystems via GenericFileSystem broken for filesystems requiring init parameters #1167

Open
@Metamess

Description

@Metamess

In our project, we use the GenericFileSystem's _cp_file function to (asynchronously) copy files from a remote SSH filesystem to our local filesystem (as suggested in this comment).

Before the release of 2023.1.0, this function accepted the parameters fs and fs2, which could be used to pass in existing filesystem instances between which the copy operation should take place. Since 2023.1.0 however, these parameters have been removed (silently and without reference in the changelog, though perhaps the 'experimental' note in the docs means changes won't get a notice?).

With the removal of these parameters, this function now only uses filesystem instances as resolved by the _resolve_fs function based on the url parameter. But, since the resolve function returns the result of a call to registry.filesystem() with only the inferred protocol as parameter (and no **storage_options), this fundamentally breaks for filesystems that require some parameter for their __init__ function, like the SFTPFileSystem (the default implementation for the SSH protocol, and which requires a host parameter).

This issue can easily be reproduced by calling the _cp_file function on a GenericFileSystem where one of the url parameters starts with "ssh://" as protocol, or any other protocol whose FileSystem implementation requires additional parameters.

Of course, if there is another workflow to get the _cp_file function working for pre-defined filesystems that is the 'intended' way, I would very much like to hear it and this issue should be closed.

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