From 035b63ea831bcd8f1e4a3afde51c807b50df0c22 Mon Sep 17 00:00:00 2001 From: vikingowl Date: Thu, 7 May 2026 17:08:52 +0200 Subject: [PATCH] fix(slm): invoke llamafile via sh to bypass Wine binfmt_misc APE polyglot binaries start with MZ magic bytes which Wine's binfmt_misc rule intercepts on Linux. llamafile is also a valid POSIX shell script; running it via 'sh' bypasses the kernel's binfmt_misc lookup entirely. --- internal/slm/manager.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/slm/manager.go b/internal/slm/manager.go index 9a60cd3..12d9427 100644 --- a/internal/slm/manager.go +++ b/internal/slm/manager.go @@ -147,7 +147,9 @@ func (m *Manager) Start(ctx context.Context) (string, error) { return "", fmt.Errorf("slm: find free port: %w", err) } - cmd := exec.CommandContext(ctx, mf.FilePath, + // Invoke via sh to bypass Wine binfmt_misc interception of APE polyglot binaries. + // llamafile is a valid POSIX shell script; sh executes the embedded launcher header. + cmd := exec.CommandContext(ctx, "sh", mf.FilePath, "--server", "--host", "127.0.0.1", "--port", strconv.Itoa(port),