tractordev / wanix

Experimental, local-first, web-native, Unix-like development environment
https://wanix.sh
MIT License
225 stars 11 forks source link

shell rebuild #123

Closed taramk closed 7 months ago

taramk commented 7 months ago

shell is not rebuilt if you edit its source and reload the page.

we think its because the kernel just overwrites the shell binary in /sys/bin every time. it should check its mtime.

Parzival-3141 commented 7 months ago

This is tricky since the shell binary in kernel/bin/ loses it's mtime data when embedded in the kernel binary, so there's nothing to compare against. We could instead only embed if the user manually built the shell outside wanix.

progrium commented 7 months ago

i think the only thing getting in the way of it working right is just that we always set sys/bin/shell.wasm with the embedded version at sys/cmd/kernel/bin/shell ... and this should only ever happen if sys/bin/shell.wasm doesn't exist. so maybe its as simple as checking if it exists before the move/rename...

it should move it on first boot, hopefully have an mtime, and then rebuilding should work and it existing means it won't be replaced next boot

Parzival-3141 commented 7 months ago

That definitely works. I assumed it was to support dev workflow, building the shell out of band. In that case, with these changes, you could delete the shell binary before reloading.

Parzival-3141 commented 7 months ago

Ideally we'd avoid embedding the shell at all to save on binary size. Could copy from /sys/dev/local/bin instead, which has mtime data.

progrium commented 7 months ago

right, it turns out to be a hard problem. we want first boot to be fast and not build, so it needs to embed it. /sys/dev won't be there in prod, which is how this part of the demo is being run.

Parzival-3141 commented 7 months ago

Ah right. I'll do it the first way then.

Parzival-3141 commented 7 months ago

@progrium is it important that we copy in all files from KernelSource? It'd shorten bootup time if checked for existing binaries before copying. We could avoid embedding the source as well if only the binaries are necessary.