Multiple crashes when using dir
Nodnarb12500 opened this issue · 9 comments
I wanted to make a test example to grab a random file and hash it and see what happens but i cant use dir at all.
(println (dir "~/"))
terminated by signal SIGSEGV (Address boundary error)
The error above also happens if you try to open a file with dir
(println (dir "/"))
free(): invalid pointer
terminated by signal SIGABRT (Abort)
(println (dir "."))
corrupted size vs. prev_size
terminated by signal SIGABRT (Abort)
I am not able to reproduce any of these crashes under MacOS, I'll investigate under Linux later, but this might just be a Linux specific problem.
just in case this could be related i compiled crowlang with -ldl
i messed with dir a but more and tried
(dir ".')
(defvar x (dir "."))
both of the above executed without crashing
it was only when i tried to print the variable or the dir output directly do i get:
corrupted size vs. prev_size
This may be an issue with arrays and array printing, can you try to print any other array value. Try these and see if any of them also crash
(println (array 1 2 3))
(println (array "Hello" "world"))
(println (split "Hello World" " "))
printing those arrays works but i also get some unprintable characters to
0�Q"�(array 1 2 3)
(array "hello" "world")
����U(array "hello" "world")
edit: never mind i just noticed they didnt work and just printed the code for the arrays, and the split function got replaced with array
That output is what is expected, there was a recent overhaul in how these things get printed. However the garbage characters are not what should be getting printed.
Have a fix for it, it seems like a buffer wasn't having its initial value set to NULL. Completely escaped me since it seems like MacOS allocates memory on zero'd pages, where Linux (and I assume windows as well) do not. Or at least the issue never happened to me. I can confirm that it fixed issues on my system, but I'll see if it fixes the issues for you before closing.
(array 1 2 3)
(array "hello" "world")
(array "hello" "world")
i believe the arrays print out as they should now
and dir works now
edit: wait theres one issue still but it might be that ~/ doesnt work in crow?
(defvar x (dir "~/"))
(println x)
fish: “~/Documents/GIT/crow/crow rando…” terminated by signal SIGSEGV (Address boundary error)