Re: https://www.reddit.com/r/ProgrammingLanguages/comments/17zp4m7/comment/ka23kwi/
@Richard Feldman
OS: Linux
Kernel: 6.6.1-arch1-1
Roc version: nightly pre-release, built from commit 48e9b53 on So 19 Nov 2023 09:07:19 UTC
git clone https://github.com/roc-lang/roc.git
cd roc/examples/cli
roc build file.roc
./file
#FISH
cwd: /home/dev/programs/rocgit/examples/cli
Dir.list...
munmap_chunk(): invalid pointer
fish: Job 1, './file' terminated by signal SIGABRT (Abort)
#BASH
cwd: /home/dev/programs/rocgit/examples/cli
Dir.list...
munmap_chunk(): invalid pointer
Aborted (core dumped)
thanks for reporting this! Would you mind sharing what Linux distro this was?
might help us reproduce
I'm pretty sure this is an old issue that I have looked at a few times and am still confused by.
interesting - when I dbg
the error, it's showing NotSeekable
- @Luke Boswell any ideas on why basic-cli would be giving a NotSeekable
error there? Maybe a glue issue, and the value is coming across wrong?
Richard Feldman said:
thanks for reporting this! Would you mind sharing what Linux distro this was?
EndeavourOS Linux x86_64
thanks!
@Brendan Hansknecht any chance your recent glue updates would fix this in basic-cli 0.6, or at least change the error in a way that gives a clue what the problem is?
not that I know of. But maybe changing to passing pointers for glue functions might fix this.
In general I think Dir.list
has been broken for a long while due to some strange memory bug. It may also be what is breaking #beginners > listing files in a directory
Been a while since I looked at any of this, so would have to refresh myself
Dir.list is definitely broken on basic cli. I just fixed it for basic webserver yesterday. We can copy-paste that implementation and it should be identical. (on my phone rn)
I was thinking this morning before work I should make a PR for that before someone runs into that issue. :upside_down:
@Brendan Hansknecht @Luke Boswell how difficult is fixing this type of bug for a person who only has a vague of how Rust and how compilers work? is it more like:
good first issue
tagIm not sure about the NotSeekable error specifically, I can look into it but I'm pretty sure the current implementation just returns a hardcoded Error tag.
This is super easy really. There is an identical implementation working in basic-webserver that can be copied into basic-cli. Its in the platform/src/lib.rs file. Both called dirList. Acutally I think roc_fx_dirList
and dir_list
.
found it, todo!("handle Dir.list error");
might be the reason ;)
Oh, I just realized that this is using the file.roc
from the roc repo, which uses the super old fork of basic cli. I think that we should really remove that old fork of basic cli and make these either:
As it stands, we are just asking for extra bugs and confusion.
We wanted to keep some examples in the repository for testing reasons. Maybe these should be moved out of the examples folder and deeper into a testing crate?
A lot of people click on the examples folder in the top level of the repository
I know, I strongly think we should re-evaluate that for anything basic-cli, basic-cli lives elsewhere now. Also, yeah, anything depending on a local basic-cli should move to cli testing examples. We can still have examples that use the proper distribution of basic cli
Also, NotSeekable
and Other
are 1 away from each other in the enum. Maybe something is off by one or glue needs to be regenerated? Not fully sure, but it should be returning Other
according to the current source code. Some reason, that is just becoming a NotSeekable
I guess it is also possible that it is a dbg
bug.
cwd: /home/bob/roc/examples/cli
Dir.list...
fish: Job 1, 'roc run file.roc' terminated by signal SIGSEGV (Address boundary error)
roc build file.roc
:hammer: Rebuilding platform...
0 errors and 0 warnings found in 590 ms while successfully building:
file
./file echo.roc
cwd: /home/bob/roc/examples/cli
Dir.list...
fish: Job 1, './file echo.roc' terminated by signal SIGSEGV (Address boundary error)
./file
cwd: /home/bob/roc/examples/cli
Dir.list...
fish: Job 1, './file' terminated by signal SIGSEGV (Address boundary error)
Just wanted to update that it still fails? Im a n00b.
Last updated: Jul 05 2025 at 12:14 UTC