Comments (6)
The functions in pwd.h
are part of POSIX.1, but they don't fit the WASI model very well.
What are our options here?
- Complete emulation. That would go a little bit beyond WASI's goal, especially for wasi-core.
- Returning hard-coded values. That would be lying to applications. Even though this is what some environments are doing already , in the context of WASI, it may break common assumptions (for example, the fact that a user's directory exists and is writable - it might not be the case).
- Do not define these functions. Applications already deal with that case in order to work natively on Windows. And this is even the case in the library you are trying to compile, even if it explicitly checks for Windows.
--
The second option would be easy to do, but I'm not convinced that, for example, a UNIX group ID or the path to the user's shell make sense for code that runs on a web page
If a desktop application specifically needs this, it can use a dedicated WASI extension that returns the real values.
But with wasi-core being designed to be the lowest common denominator, I think not defining these functions is acceptable.
That's just my $2. I'd be happy to implement other options if other people think something else would be the right thing to do.
from wasi-libc.
pwd.h
is not available and I'm not sure whether it ever will be due to the nature of WASI sandbox which by definition is devoid of the concept of a user, etc. @jedisct1 or @sunfishcode could probably fill in the details here nicely.
Anyhow, in terms of compiling C projects to WASI, one way of dealing with this sort of issues is to either completely turn off any such functionality in the lib (e.g., adding custom #define
s that would turn it off when compiling to WASI), or put some stubs in instead. If it's of any help, you can have a look at this repo here where I've had to disable the use of setjmp.h
which is also currently not supported, and here are a couple of short blogposts providing some higher-level overview of how to port to WASI: Compiling C to WebAssembly using clang/LLVM and WASI by @jedisct1, and Porting projects to WASI: the flite program written by me.
Let me know if this makes sense!
from wasi-libc.
But what would it even do? How would a desktop Linux app use e.g. LDAP via pam_ldap?
Is it even what all applications will need?
How to authenticate users on Windows?
Where is the user database in a web browser, and what do the userid and groups mean?
Do we need to store virtual users in a database instead? How to manage it?
User authentication can be part of a wasi extension, or even be a completely distinct project. But not only pwd.h
is a non-portable and obsolete API for it (how do I authenticate using Touch ID?), it is also likely to be a bit too big of a thing to be in wasi-core.
from wasi-libc.
Could the PWD concept not be built on top of wasi in user space? My understanding is that we are doing this for open
via libpreopen
. open
itself doesn't exist in wasi-core but that doesn't mean it has no place in the sysroot. Is there any reason why PWD couldn't be user space thing too?
from wasi-libc.
Oops, I completely misread this a bug about getcwd()
:)
from wasi-libc.
Updated the title to avoid confusion.
from wasi-libc.
Related Issues (20)
- Adding `IFTODT` for more compatibility HOT 1
- A few packaging nits, coming from Nixpkgs/NixOS HOT 6
- Confusion around SIGCHLD value? HOT 2
- WASI signal numbers out of sync with wasi-libc signal numbers HOT 15
- Latest SIMD patch HOT 2
- fd_set implementation is inefficient HOT 5
- Support for `accept{,4}` HOT 3
- Implement the new preopen scheme in wasi-libc HOT 1
- __wasm_call_ctors broken previously wokring rust wasm reactors HOT 2
- getpagesize() HOT 4
- README seems to be wrong wrt minimal LLVM version HOT 4
- Provide socket option definitions HOT 3
- Missing __WASI_RIFLAGS_RECV_DATA_TRUNCATED for MSG_TRUNC HOT 1
- help how to disable feature for example( bulk memory)? HOT 1
- Humble request from distro packagers to start releasing versions HOT 6
- poll() with timeout fails with "timer subscriptions only support monotonic timer" HOT 1
- dlmalloc has license incompatible with Fedora policies HOT 12
- Migrate build system to CMake HOT 4
- How to distribute `THREAD_MODEL=posix` builds? HOT 46
- Is it safe to have mixed sbrk and malloc calls? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasi-libc.