Git Product home page Git Product logo

Comments (7)

sunfishcode avatar sunfishcode commented on August 31, 2024

Yeah, WASI doesn't have absolute paths, so the standard realpath doesn't fit. I filed #82 to remove the declarations.

That said, besides making paths absolute, realpath also resolves symbolic links, resolves .. and . paths, and trims redundant / characters. We could conceivably have a realpath which does those things and maybe also resolves relative paths to be rooted at ., which might be enough for some use cases.

from wasi-libc.

sbc100 avatar sbc100 commented on August 31, 2024

It doesn't have absolute paths at the syscall layer, but doesn't it kind of emulate them in libpreopen? I mean if the concept of PWD exists then can't realpath just use getcwd() to construct an abspath?

from wasi-libc.

sunfishcode avatar sunfishcode commented on August 31, 2024

We don't currently have getcwd either :-). libpreopen maps from absolute path to base + relative path, which isn't enough to do getcwd.

Should we add a getcwd? It does leak information about the host, and we can't easily virtualize or remap it because the main purpose is to get a string that you can send to another process or serialize out somewhere to be read by the outside world, so it has to reflect the actual host path name.

from wasi-libc.

pchickey avatar pchickey commented on August 31, 2024

I think we should encourage the programs that require these sort of absolute path functions to implement them totally in userland, if possible. I wouldn't want to expose the host's "real" cwd at all, but it should be possible to define these functions such that it always pretends to be under /home/wasi or something, right?

from wasi-libc.

sbc100 avatar sbc100 commented on August 31, 2024

No, I'm not talking about exposing the real host cwd. But we can build cwd in userspace based on the pre-opened root fd can't we? I'm surprised libpreopen doesn't do this already. Wouldn'tit be as simple as doing: base + global_cwd + relative?

I don't understand what you mean about sending the string to the outside world. Paths only make sense within a given module, right? Or at least within modules that shared the same virtualized view of the filesystem.

from wasi-libc.

binji avatar binji commented on August 31, 2024

Right, I'd imagine it would be similar to running in a chroot.

from wasi-libc.

sunfishcode avatar sunfishcode commented on August 31, 2024

The original issue here is fixed in a413650; we no longer declare realpath.

If anyone's interested in introducing a concept of a cwd, even without exposing the host cwd, we'd need new WASI support, so we should discuss this in the WASI issue tracker.

from wasi-libc.

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.