Giter Site home page Giter Site logo

smb2_rename_async failed about libsmb2 HOT 11 CLOSED

sahlberg avatar sahlberg commented on September 7, 2024
smb2_rename_async failed

from libsmb2.

Comments (11)

afedchin avatar afedchin commented on September 7, 2024 1

use '\' in the path.
this should work

smb2_rename_async(smb2, "123\\abc.txt.tmp", "123\\abc.txt", smb2_rename_cb, NULL);

from libsmb2.

sahlberg avatar sahlberg commented on September 7, 2024 1

smb2_rename_async is buggy. Since this function tries to emulate posix it should
remap '/' to '' for you, but it doesn't.
Until I fix this bug you can use the workaround that @afedchin suggested.

smb2_unlink works as expected as does most other path paced calls since almost all calls will end up becomming a SMB2 Create + SMB2 + SMB2 close chain.

SMB2 Create does this remapping.

Rename is different since it uses a Set Info command to provide the new/old names.
This is why rename behaves differently to almost all other commands.

I will fix this bug in rename.
Thanks for testing and report.

from libsmb2.

laoyur avatar laoyur commented on September 7, 2024

@afedchin thanks, it works !

url = smb2_parse_url(smb2, "smb://[email protected]/share/abc/123.txt");
url->path == "abc/123.txt"
why url->path not "abc\\123.txt" ? I don't understand it well.

from libsmb2.

afedchin avatar afedchin commented on September 7, 2024

why url->path not "abc\123.txt" ? I don't understand it well.

because it's a path in an URL. SMB should use \ for paths. SMB path != URL path.

from libsmb2.

laoyur avatar laoyur commented on September 7, 2024

ok, but why this works:

smb2_unlink(smb2, "123/abc.txt");

I just feel confused ...

from libsmb2.

laoyur avatar laoyur commented on September 7, 2024

it seems like other apis accept /, but smb2_rename_async supports \ only ?

from libsmb2.

amosavian avatar amosavian commented on September 7, 2024

82cce4a addressed this for open function.

from libsmb2.

laoyur avatar laoyur commented on September 7, 2024

@sahlberg thanks :)
is there any chance to bring the sync version of rename ?

from libsmb2.

sahlberg avatar sahlberg commented on September 7, 2024

from libsmb2.

laoyur avatar laoyur commented on September 7, 2024

Hi, I'm on iOS and currently using the pre-compiled lib from https://github.com/amosavian/AMSMB2
I've tried to build myself via the script provided within that project, but no luck
Your fix seems ok. I'll let you know later if I have time to make the build success.

from libsmb2.

amosavian avatar amosavian commented on September 7, 2024

@laoyur please open an issue in AMSMB2 repository if you have any problem including failure to build.

from libsmb2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.