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

Socket::IPAddress.valid? does not always work #13191

Closed
HertzDevil opened this issue Mar 15, 2023 · 3 comments · Fixed by #13463
Closed

Socket::IPAddress.valid? does not always work #13191

HertzDevil opened this issue Mar 15, 2023 · 3 comments · Fixed by #13463
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:networking

Comments

@HertzDevil
Copy link
Contributor

HertzDevil commented Mar 15, 2023

The following should return true, but it returns false on some Windows versions:

Socket::IPAddress.valid_v6?("::1:2:3:4:5:6:7")

Apparently Windows Server 2022 fixed this, but it might be better to port LibC.inet_pton to pure Crystal. Some reference implementations: glibc, musl, bionic

@HertzDevil HertzDevil converted this from a draft issue Mar 15, 2023
@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. platform:windows Windows support based on the MSVC toolchain / Win32 API topic:stdlib:networking labels Mar 15, 2023
@HertzDevil HertzDevil moved this from Backlog to Todo in Windows Support Mar 15, 2023
@meatball133
Copy link
Contributor

meatball133 commented Mar 15, 2023

I tried this on my machine and it returns true as well. I am running windows 11, so I guess windows 10 is the os version that doesn't work?

@straight-shoota
Copy link
Member

It definitely failed before the CI update to Windows Server 2022, that is on Windows Server 2019. Not sure where that leaves Windows 10 because both server releases are based on that. But it is safe to assume it failed on some earlier version of the desktop OS as well.

@HertzDevil
Copy link
Contributor Author

According to the specs in spec/std/socket/address_spec.cr, glibc and Darwin also have their own failing cases

@HertzDevil HertzDevil removed the platform:windows Windows support based on the MSVC toolchain / Win32 API label Apr 21, 2023
@HertzDevil HertzDevil changed the title Socket::IPAddress.valid_v6? does not always work on Windows Socket::IPAddress.valid? does not always work Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:networking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants