jart / cosmopolitan

build-once run-anywhere c library
ISC License
18.38k stars 633 forks source link

[redbean] Error using `StoreAsset()` #1044

Open siiky opened 10 months ago

siiky commented 10 months ago

The function StoreAsset() gives an error with redbean 5c358635, built with MODE=tinylinux, running with the -* flag, and on a Debian testing x64 PC.

-- .init.lua
StoreAsset("test.txt", "this is a test")

The error:

I2023-12-28T01:17:10.580764:tool/net/redbean.c:3637:asset-saving:1787248] (srvr) storing asset "test.txt"
W2023-12-28T01:17:10+000016:tool/net/redbean.c:3664:asset-saving:1787248] (srvr) can't place write lock on file descriptor 3: Bad file number

A similar issue was brought up recently (just a few months ago), but no conclusion as far as I can tell. I came across this also actually trying to get TiddlyWiki working with redbean, using https://github.com/amreus/tiddly-bean

pkulchenko commented 10 months ago

StoreAsset has been disabled, as it's not in a fully workable state. See this comment in __open_executable, which StoreAsset depends on: https://github.com/jart/cosmopolitan/blob/5c358635249616157b1e02c603ceb852dfc33ef7/libc/runtime/openexecutable.c#L24.

siiky commented 10 months ago

Got it, thanks! It's not really disabled, though, because a user can call it..?

https://github.com/jart/cosmopolitan/blob/5c358635249616157b1e02c603ceb852dfc33ef7/tool/net/redbean.c#L3664

In the meantime I tried redbean v2.2 as that message suggests and it's working!