Fix Windows setup/build issues and two framebuffer msync hangs#1
Open
tfthushaar wants to merge 2 commits into
Open
Fix Windows setup/build issues and two framebuffer msync hangs#1tfthushaar wants to merge 2 commits into
tfthushaar wants to merge 2 commits into
Conversation
Windows-specific fixes for setup scripts and the native ARM build, plus two real bugs in the native dashboard found via on-device testing on a Kindle Paperwhite 3 (armel/soft-float): - scripts/bootstrap-insforge-kit.mjs, scripts/configure-telegram.mjs: invoke the InsForge CLI's JS entry point directly via node instead of shelling out to `npx`, which fails on Windows in multiple ways (ENOENT without a shell, EINVAL with one due to Node's CVE-2024-27980 hardening on .cmd files, and silent argument-mangling by cmd.exe once shell:true is added). Also switches migration application back to `db query <content>` instead of `db import <path>`, which crashes natively inside the CLI on Windows for at least one migration file. - kindle/native/src/kindle_dashboard.cpp: - Add a portable M_PI fallback (POSIX/glibc extension, not standard C++; undefined when cross-compiling with Zig's bundled libc++). - Remove two independent `msync(fb, screensize, MS_SYNC)` calls on the mmap'd /dev/fb0 framebuffer. This Kindle's fbdev driver hangs indefinitely on msync for a device-backed mapping (msync is for syncing file-backed mmaps to disk; it's both unnecessary and apparently unimplemented correctly here). One instance completely blocked every render; a second, duplicated instance in the tap-visual-feedback code path blocked every interactive touch after the first. Found both via targeted fprintf/fflush bisection logging rather than static reading. - Add invertCanvasIfDark(): --invert-images previously only flipped specific loaded bitmap assets, never the dashboard canvas itself, so dark mode had no visible effect. Now inverts the full canvas. - .gitattributes (new): pin *.sh and *.sql to eol=lf. The repo's stored blobs are already LF, but with no .gitattributes, a Windows contributor with the common core.autocrlf=true git setting gets CRLF silently reintroduced on checkout -- which breaks Kindle-side /bin/sh scripts completely silently (no error, no log output at all) and is very easy to misdiagnose as a FAT/exFAT permissions issue instead. - WINDOWS_FIXES.md (new): full writeup of all of the above with root causes, debugging approach, and fixes, for repo maintainer review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes found while getting this project running end-to-end on Windows, for a Kindle Paperwhite 3 (armel/soft-float).
Setup scripts
scripts/bootstrap-insforge-kit.mjs,scripts/configure-telegram.mjsShelling out to
npx @insforge/clifails on Windows in three stacked ways:ENOENTwithout a shellEINVALwith one, due to Node's CVE-2024-27980 hardening on.cmdfilescmd.exeonceshell: trueis added (breaks any arg with spaces/newlines)Fix: invoke the CLI's JS entry point directly via
nodeinstead — no shell involved. Also switches migration application todb queryinstead ofdb import, which crashes natively on Windows.Native build
kindle/native/src/kindle_dashboard.cppM_PIfallback (POSIX/glibc extension, undefined with Zig's bundled libc++ when cross-compiling)msync(fb, screensize, MS_SYNC)calls on the mmap'd/dev/fb0framebuffer, which hang indefinitely on this device's fbdev driver--invert-imagesonly flipped specific bitmap assets, never the actual canvas, so it had no visible effect. Added a full-canvas inversion pass..gitattributes(new)Pins
*.sh/*.sqltoeol=lf. With none present, a Windows contributor with the commoncore.autocrlf=truegit setting silently gets CRLF checked out into Kindle-side shell scripts, which then fail completely silently on-device.Details
Full root-cause writeups, debugging approach, and reasoning for each fix are in
WINDOWS_FIXES.md.