A fix for "Cannot allocate memory" at macOS with CI pinning#3720
A fix for "Cannot allocate memory" at macOS with CI pinning#3720GulinSS wants to merge 4 commits intoidris-lang:mainfrom
Conversation
- Pin Node.js installation from latest to version 24 for consistency (version 24 is currently the latest) - Pin Chez Scheme installation to specific version 10.3.0 (10.x is required by coming idris-lang#3704) - Add pinned Racket installation via Homebrew cask to run Racket backend tests on macOS (cherry picked from commit 0ac7e79)
(cherry picked from commit 907a5f0)
|
An attempt to fix via using |
| let call = "((foreign-procedure" ++ callConv ++ " " ++ showB cfn ++ " (" | ||
| ++ sepBy " " argTypes ++ ") " ++ retType ++ ") " | ||
| ++ sepBy " " !(traverse buildArg args) ++ ")" | ||
| let builded_args = !(traverse buildArg args) |
There was a problem hiding this comment.
It might be better to use a scheme FFI call and do this in scheme, if we need it. Hardcoding the name here is a big fragile. (If this is just for experimenting, that's fine.) Although we would have to reconcile the other backends.
Also, I don't know if this is going to do the trick here. Wouldn't a single with-interrupts-disabled need to be wrapped around both the call to nextdir and an fetch of the errno.
If we fetched the errno within the nextDirEntry, we might be good. The question is how to return the equivalent of Either Error AnyPtr. I don't know that Idris allows returning inductive types and if we hard code assumptions about data shape, that too might be fragile - PureScript passes in constructors to accomplish this, but Idris doesn't like those types in FFI calls.
Ideally we could return Either Int (Ptr String) for nextDirEntry, but I can't think of a good way to make that happen.
One option that comes to mind is to make our own errno - create a structure that has both DirInfo * and errno in it, and a call to ask it for its errno. Return that for opendir and free it in closedir. We update its errno value inside idris2_nextDirEntry and the idris side looks up the errno from this Directory object rather than the global one. (If RefC, Javascript, etc are not concerned with this issue, they could simply look at errno to implement getDirError.)
|
Yeah, it is just a draft/sample of attempts over our existing CI at |
Just to track the attempt to fix of macOS
readdirissue