Repository navigation
SMB: implement cp_file instead of overriding copy - #2558
atishay-kasliwal wants to merge 1 commit into
Conversation
The copy override passed every keyword argument on to smbclient.copyfile, so recursive=False from the generic signature raised a TypeError, and folders and lists of paths were never expanded. cp_file keeps the server-side copy and lets the generic copy handle recursive, maxdepth and on_error.
|
The recursive/list support is useful. I found one backward-compatibility case at With I used the real fsspec copy/expansion code with a filesystem-backed |
|
Thanks for checking. That's how the generic |
Fixes #2557.
SMBFileSystem.copypassed every keyword argument tosmbclient.copyfile, sofs.copy(a, b, recursive=False)failed withTypeError: get_smb_tree() got an unexpected keyword argument 'recursive'. Folders and lists of paths never got expanded either.This takes the approach suggested in the issue. The
copyoverride is replaced withcp_file, which still copies on the server withsmbclient.copyfile, and the genericcopyhandlesrecursive,maxdepth,on_errorand lists.cp_filecreates the target folder when the source is a folder, likeLocalFileSystem.cp_filedoes.test_copycovers a single file withrecursive=False, a recursive folder copy, and a list of paths. I ran the SMB tests against Samba 4 on port 9999 with the same user and share as the docker fixture. All 9 pass, and without the changetest_copyfails with the TypeError above.