I get a weird segfault when reading files larger than 997 bytes. In the reproducible case below, all of the main function is run, but the process crashes.
python3 -c "print('X' * 996)" > file
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.17.0/lZFLstMUCUvd5bjnnpYromZJXkQUrdhbva4xdBInicE.tar.br" }
import pf.File
parse = \s ->
s
|> Str.splitOn "\n"
|> List.dropFirst 1
|> List.dropIf Str.isEmpty
main =
dbg (File.readUtf8! "file" |> parse)
Task.ok {}
❯ roc build ./tmp.roc
0 errors and 0 warnings found in 156 ms while successfully building:
./tmp
❯ ./tmp
[./tmp.roc:12] File.readUtf8! "file" |> parse = []
fish: Job 1, './tmp' terminated by signal SIGSEGV (Address boundary error)
❯ roc version
roc nightly pre-release, built from commit 97ab13e on Mi 18 Dez 2024 09:02:06 UTC
is this on linux (asking cause works just fine on m1 mac)?
Also, can you test with --linker legacy
Yes, linux 6.12.4; --linker legacy
fixes the problem
interesting. I wonder what is going wrong with the surgical linker here (or with the platform built for the surgical linker)
Can you file an issue on the basic-cli repo @conradin laux?
Last updated: Jul 05 2025 at 12:14 UTC