Skip to content
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

return proper ERRNOs in OpenDirectory.path_open #37

Merged
merged 1 commit into from
Sep 5, 2023
Merged

return proper ERRNOs in OpenDirectory.path_open #37

merged 1 commit into from
Sep 5, 2023

Conversation

ansemjo
Copy link
Contributor

@ansemjo ansemjo commented Sep 5, 2023

Hello again! ☺️

I was trying to get a Python interpreter to run in the WASI shim and got weird errors like this:

Exception ignored error evaluating path:
Traceback (most recent call last):
  File "<frozen getpath>", line 353, in <module>
OSError: [Errno 65535] Success
Fatal Python error: error evaluating path
Python runtime state: core initialized

Current thread 0x00000000 (most recent call first):
  <no Python frame>

After enabling strace and uncommenting the console.log line, which prints the path, I found that the interpreter was trying to open pyvenv.cfg and pybuilddir.txt. Including those in the shimmed filesystem (even as empty files) allowed the interpreter to continue. However, the underlying problem is probably that the interpreter gets confused by the -1 return code on nonexistent files.

Therefore, this commit uses the (I hope) appropriate ERRNOs in OpenDirectory.path_open, so the interpreter also works when those files do not exist in the filesystem.

It is accompanied by another, functionally independent PR (#38), which shims sock_accept in the imports. Both are needed for Python to work.

@ansemjo ansemjo mentioned this pull request Sep 5, 2023
@bjorn3 bjorn3 merged commit 79d4e12 into bjorn3:main Sep 5, 2023
1 check passed
@bjorn3
Copy link
Owner

bjorn3 commented Sep 5, 2023

Yeah, proper error numbers should be returned everywhere. I believe there are a couple of other places where I used -1 as generic error, but this is already an improvement. Thanks!

@ansemjo ansemjo deleted the fix_errno_in_path_open branch September 5, 2023 13:42
@bjorn3
Copy link
Owner

bjorn3 commented Sep 5, 2023

Looks like I forgot to publish a release for your last set of changes. Is this everything you need for now? If so I will publish a new release right now.

@ansemjo
Copy link
Contributor Author

ansemjo commented Sep 5, 2023

No worries! I've been using a local fork in the meantime because I've been testing things on and off anyway. ☺️

I think that's all for now, yes. Thanks!

@bjorn3
Copy link
Owner

bjorn3 commented Sep 5, 2023

Published v0.2.15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants