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

openbsd: skip tests using Dir.realpath #7071

Merged
merged 1 commit into from
Nov 13, 2020

Conversation

semarie
Copy link
Contributor

@semarie semarie commented Nov 11, 2020

The Dir.realpath() implementation is based on getFdPath(), which doesn't exist on OpenBSD (or some others OS like FreeBSD). Disable the tests using it for now.

I am thinking about some ways to provide alternative implementation, for example:

  • add the know pathname used to open the descriptor in zig structure and resolv it on demand with realpath(); but not all descriptors are opened with a name: on exec you could have an already open descriptor, or you could receive descriptor from UNIX socket
  • iterate on descriptor to retreive the name from filesystem (with openat(fd, "..") and searching for the right inode with fstat()) ; but it could be permission issue to read directory content
  • call chdir() on the descriptor and read the path with getcwd() ; but it is bad when threads are involved (it changes a global parameter)

I will see that later.

Copy link
Member

@kubkon kubkon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's really interesting! I thought that only FreeBSD lacked facilities to implement getFdPath() but evidently it is not so. So OpenBSD doesn't have a mechanism similar to macOS's custom fcntl commands, or Linux's /proc hack?

BTW, while we're here, I'd like to propose that we start looking out for an OpenBSD CI somewhere. As far as I can see we don't currently test this target, and I'd hate to introduce a regression just because we didn't have the testing harness in place. This would nullify a lot of your great hard work on this @semarie.

@semarie
Copy link
Contributor Author

semarie commented Nov 11, 2020

OpenBSD doesn't have such mecanism for getting the path of the current process, and even more so for a random file descriptor 😃

Regarding CI, for me it is too early. Regarding OpenBSD support:

  • llvm11 source tree needs patches to support OpenBSD
  • libc++, libc++abi and libunwind needs patches to support OpenBSD (the ones from zig doesn't compile - I patched zig to use the host libraries to workaround)

@andrewrk andrewrk merged commit ab4b34f into ziglang:master Nov 13, 2020
@semarie semarie deleted the openbsd-fs_realpath branch November 19, 2020 09:08
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.

3 participants