Giter Site home page Giter Site logo

martin12333 / browserposix-discussion Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 0.0 11 KB

a pseudo-repo for discussion on Unix-like software in JS+Wasm ... and also about *browser* Python, Lua, Tcl.

License: The Unlicense

busybox coreutils cowasm emscripten linux lua posix pyodide python reddit rust tcl unix unix-shell wasi wasix wasm wasmer webassembly webvm

browserposix-discussion's People

Contributors

martin12333 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

browserposix-discussion's Issues

Interesting recent issues/comments related to Unix-like software in Webassembly and JS

shellcode expoilts and browser exploits are not the same

I thought linx was safer to internetz.

I always wanted to browse l33t using text terminals. It does not do java script, i am safe but i cant see renders.

So i switched to browsers, they have client script blocking but cant prevent browser fingerprinting.

now i access a website that has no SQL injection because inetd always gives me a reason to not use it this season.

Selected older issues related to r/browserPOSIX

In general, the order is reversed so that the last layer you add would be the top layer—accessed first. With regards to streams, be careful, because streams are not implemented correctly in unionfs, i.e. createStream will not try to read from all layers, instead the first createStream found is used to create a stream and that stream will only work with that specific layer.

python's http.server is not enough. You need sth to return correct MIME codes


I would like to be able to make http requests via urllib (or similar) in Python in the browser.

Which unix-like programs are [not] difficult to port to Webassembly?

partial list of functions, that are problemmatic in webassembly



related: https://github.com/SamsungDForum/Webports ... webports is collection of open source libraries and applications that have been ported to Native Client, along with set of tools for building and maintaining them.
Some of them were ported to Emscripten also.

Putting some ideas into the pot...

Since this is about POSIX and the browser, crucial question is - what is meant by that?

POSIX is in the first place an OS design specification, that describes several interfaces and concepts on different levels (from typical kernel C interfaces, some userland definitions baked into C libs up to high level interaction paradigms like shell env).

From a C programmers perspective POSIX compliance means, that as long as the system provides the POSIX subset (by a clib and a suitable compiler), my program still compiles and runs as expected.
From a kernel programmers perspective it means, the kernel has to implement certain interfaces a C-lib can hook into, like processes, threads, file IO, socket, pipes, privilege system, terminal - and all with a certain behavior.
A userland programmer from other POSIX systems will feel familiar with the env, given his language was ported as well.
Finally for the user it means, he gets all the beloved or hated terminal tools and the Unix way to solve things.

Urgh, thats already quite much and not even going into any details. One word at start - a fully-fledge POSIX env seems quite impossible to me in a browser without CPU emulation. Going down to CPU emulation gives you all the freedom to shape things as you wish, but will suck hard on resources (prolly making things unusable in the end). To me a more interesting question is - is it possible to give up some expectations from above and build something closely POSIX-related with interfaces, that the browser already ships with?

Whats already there?

  • emscripten has done a great job bringing C to the browser. It ships with a custom libc with tons of POSIX shims. Def. a good starting point to get the C programmer from above satisfied.
  • WASM The new shiny gem for binaries and browsers. They also build on certain interfaces (WASI). emscripten already transited to wasm. Note both mainly aim for single executable stack, thus no process control yet possible. Which points to a big showstopper, what about a kernel?

Regarding a kernel like shim the best I could find is browsix. Everything else with serious efforts into that direction is again emulation based, and there is a reason for this. The browser env (with JS/WASM/worker threads) simply cannot efficiently mimick certain kernel tasks, like process fork/exec, or interrupting of running tasks. What sounds like a minor nasty side effect is really a big showstopper - you simply cannot put some task into a kernel like guard role, which puts the whole idea of preemptive multitasking in POSIX on trial, it also introduces big performance issues in emscripten, since blocking actions have to be shimmed with expensive stack forth and back unrolling. Note that also WASM does not allow this, they left this out by purpose (propagating non-blocking code rewrites).

I kinda stumbled into the kernel issues myself with my playground project https://github.com/jerch/browser-fakepty. It is just trying to get some familiar terminal concepts ported (mimicking a pty), but it already pulls in tons of POSIX primitives. For the things I want to get working there I decided to stay in cooperative multitasking with JS, and wrote a few test "programs". (Did not push there in a while, still stuck on the TTY rewrite with job control and binary pipes.)

github issue v/S subreddit competing, posix and browsers - handbooks and forks

Greetings,

GDSR :
This seems like a very nice project. I was just made aware of it and i had to respond , because i am chained to my keyboard. The shackles are wearing themselves in, thank you for asking.

POSIX supports everything as a file architecture ( plan9,etc). while web needs http links to be "browser friendly".

Unix tools support a variety of protocols while porting posix tools to work in Javascript+web asm would result in "maintainable code" optimized for environment or architecture (JS doesn't care about architecture, but please bear with me).

Would this be the analogous starting point of when terminal support for programs were removed, because of it this project succeeds, we would be living in the world where everything requires a link and not all protocols work with links, just like place on earth requires a GPS coordinates. It is possible to have a nice vacation if the tour itinerary promises enough good places with good reviews right ??

repos, that are active in this month

(2022-12) Which unix-like programs are already ported to Webassembly

the state at the end of 2022

https://www.reddit.com/r/linux/comments/ztxa6a/porting_of_linux_programs_to_webassembly_the/

Selected programs, that are already ported to Webassembly:

  • busybox ... in Busytex
  • bzip2
  • coreutils (subset) ... in Cowasm; in Wasmer
  • dash shell (with issues) ... in Cowasm; and also in a branch of Wasmer
  • libreoffice
  • libedit
  • libffi
  • openssl
  • python ... PEP 11 lists what platforms are supported by CPython in some official fashion ... In the case of WebAssembly, there are two triples at the tier 3 level: wasm32-unknown-emscripten, wasm32-unknown-wasi
  • sqlite
  • tar
  • vim

Links to mini systems, that work in browser, are being collected at r/browserPOSIX

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.