Git Product home page Git Product logo

Comments (7)

talex5 avatar talex5 commented on May 27, 2024 1

BTW, this is the best documentation I could find for the 9p protocol's errors:

http://lxr.free-electrons.com/source/net/9p/error.c

from datakit.

talex5 avatar talex5 commented on May 27, 2024

Isn't this correct? The root is read-only, and /branch already exists. Is the bug that we should return File exists rather than Directory is read-only?

from datakit.

dave-tucker avatar dave-tucker commented on May 27, 2024

Maybe? It wasn't clear to me that the root was RO, but now I know! Thanks!
It didn't help matters that from the filesystem, ls didin't show a branch directory and that mkdir branch would also complete without error.

As for the error message, yes I'd expect File Exists before Directory is read-only.
What I'd like is a safe way for a client to handle certain types of error.
In the mkdir -p example. it's okay if part of the path exists and I can safely ignore the error.
It is however, not ok to ignore other errors e.g No space left on device for example.

It seems the documentation is scare for error strings... I'm not really fond of pattern matching error strings to determine the "kind" of error either 😭 but I think it's the best we can do with the protocol as it stands. Open to other ideas though...

from datakit.

talex5 avatar talex5 commented on May 27, 2024

Why didn't ls show it? It does with the Linux and OCaml clients, at least:

/Database # ls
branch     remotes    snapshots  trees
/Database # mkdir branch
mkdir: can't create directory 'branch': File exists

I guess Linux is adding the File exists here because ocaml9p shows the protocol message:

tal@Thomass-MacBook-Pro ~> ocaml9p shell 
9P > ls
drwxrwxr-x ? root root 0 Jan 1 1970 branch    
drwxrwxr-x ? root root 0 Jan 1 1970 trees     
drwxrwxr-x ? root root 0 Jan 1 1970 snapshots 
drwxrwxr-x ? root root 0 Jan 1 1970 remotes   
9P > mkdir branch
Directory is read-only

strace shows:

mkdir("/Database/branch", 0777)         = -1 EEXIST (File exists)

from datakit.

talex5 avatar talex5 commented on May 27, 2024

Closing, as I don't think there's anything to fix here. Linux reports "file exists" rather than "read only" because it checks whether the directory exists before calling mkdir, and you can do that too if you want. Please reopen if you disagree.

from datakit.

dave-tucker avatar dave-tucker commented on May 27, 2024

Nope, I think this was probably user error ;)
The mkdir thing I mentioned was user error - I was using the host filesystem.
Happy to help adding some docs :D

from datakit.

talex5 avatar talex5 commented on May 27, 2024

More docs are always welcome :-)

from datakit.

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.