neonious / lowjs

A port of Node.JS with far lower system requirements. Community version for POSIX systems such as Linux, uClinux or Mac OS X.
http://www.lowjs.org/
Other
1.27k stars 72 forks source link

Implemented process.umask #108

Closed Hypfer closed 4 years ago

Hypfer commented 4 years ago

There are still libraries that rely on this recently deprecated functionality.

mkdirp for example which is a dependency of the expressjs middleware multer which handles multi-part form uploads

ThomasRogg commented 4 years ago

First, thank you for all the push requests! Why are you looking into low.js? Did all the things pop up while working on a project?

Regarding this one, I do not agree.

First, process.umask(mask) is not depreciated. Only to not give a mask (= giving undefined as mask).

On Linux/mac OS/whatever I would actually implement it correctly by calling umask()... Just one line + error handling. On ESP32 where there is nothing like permissions I would return 022 (octal), which is what most programs would expect, I guess, because it is the default. But I guess the last is a question of taste.

But in any case, if implemented, I would make it run correctly on the non-ESP32-systems.

Thomas

Hypfer commented 4 years ago

Yep this is all related to my attempts at running Valetudo using lowjs. In short, Valetudo is a cloud replacement which runs on rooted robot vacuums and provides a local-only control interface.

Currently, it's using zeit/pkg to bundle the nodejs runtime + the application files which results in 46mb+ binaries. Not exactly something suited for an embedded environment like a household appliance. Newer vacuum models come with both less ram and persistent memory so there's definitely an incentive to optimize this part.

I haven't tested the DukTape performance yet. I guess it will be much slower than the JIT-compiled v8 magic. Still, there's always the option to add native modules for performance-hungry stuff like e.g. map parsing.

My findings about this can be found in this issue comment: https://github.com/Hypfer/Valetudo/issues/522#issuecomment-629663350

First, process.umask(mask) is not depreciated. Only to not give a mask (= giving undefined as mask).

Oh! Indeed. I completely misinterpreted that.

Unfortunately, C really isn't my preferred language so I'm a bit lost regarding how to properly implement that