-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with File.real_path on macOS catalina #8431
Comments
Here's another example: I ran the command one time, made zero changes to code, used the same binary, made zero changes to any settings, configuration, etc. anywhere and it just died I can run the executable a dozen times and it runs fine twice, fails the other 10 with a mixture of failing on different file paths. It could 100% be my poorly written code (https://github.com/jaydorsey/colorls-cr) but it worked fine until the Catalina upgrade |
So, I found a workaround for this issue, but I think this might still be a bug? In my code, I'm capturing both the relative path to the file/folder and the absolute path. I'm calling Calling it against the absolute path every time seems to work OK This may or may not even be a Catalina-related bug, but I know this wasn't an issue on 0.30.0 before I upgraded, and now it doesn't work on 0.30.0. I don't have another macOS machine to test this out on. |
Per this bug: crystal-lang/crystal#8431 This stopped working after Catalina, this makes things work again
Works OK in /tmp ? Something doesn't feel right here... |
If it's an OS bug there's not much we can do... |
Well if it only affects relative paths we could consider running |
I haven't tested in anything but macOS High Sierra & Catalina. Seems like it could be an OS bug but there's other factors that could come into play so I was hoping others could jump in as well. |
If related, I've discovered over on the linked Julia issue that the name of the DARWIN_BETTER_REALPATH function is actually "realpath$DARWIN_EXTSN". This renaming is done automatically when parsing C header files, but I suspect that crystal (like julia) just embeds the name at
|
I'm closing this for now; there's a sufficient workaround as I noted above in addition to the workaround noted in the linked comment issue about the FFI function behavior. With the workaround, I've had no issues |
@vtjnash apparently using that symbol is all we needed to fix this issue! |
I have a little toy crystal app I've been building that just reads a list of files/folders from a path and spits out the files & folders with some terminal codes to colorize stuff.
I recently upgraded to macOS catalina and it appears that File.real_path on macOS Catalina is broken
I can reproduce the error with the steps below.
mkdir -p foo/bar && cd foo
echo "puts File.real_path(\"bar\")" > foo.cr
crystal build foo.cr
./foo
An error message occurs:
The executable will work OK, intermittently, without making any changes to anything.
What I've tried to resolve:
foo
executable full disk accessI made zero code changes, didn't regenerate the binary, or make system preference changes in the example below, and note that it jus randomly worked once (and failed again after that):
I got the idea to run it a couple times from here; Julia users are seeing similar behavior with their implementation (not a Julia user, found that link via a Google search after I didn't see any results in the Github Issues here)
Tested on macOS Catalina (10.15) with a couple Crystal versions, but I'm trying to get it working in latest (using asdf for version management to download the latest compiled binaries)
The text was updated successfully, but these errors were encountered: