Stream: bugs

Topic: Segmentation fault in basic-cli


view this post on Zulip conradin laux (Dec 19 2024 at 18:09):

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

view this post on Zulip Brendan Hansknecht (Dec 19 2024 at 18:15):

is this on linux (asking cause works just fine on m1 mac)?

view this post on Zulip Brendan Hansknecht (Dec 19 2024 at 18:16):

Also, can you test with --linker legacy

view this post on Zulip conradin laux (Dec 19 2024 at 18:27):

Yes, linux 6.12.4; --linker legacyfixes the problem

view this post on Zulip Brendan Hansknecht (Dec 19 2024 at 18:49):

interesting. I wonder what is going wrong with the surgical linker here (or with the platform built for the surgical linker)

view this post on Zulip Anton (Dec 20 2024 at 09:59):

Can you file an issue on the basic-cli repo @conradin laux?


Last updated: Jul 05 2025 at 12:14 UTC