haraldh / rust_uds_windows

Unix Domain Sockets for Windows!
MIT License
28 stars 6 forks source link

Wine compatibility; NTSTATUS ERROR_NO_SUCH_DEVICE #15

Open siltyy opened 4 months ago

siltyy commented 4 months ago

When trying to connect to a pathname UNIX domain socket with a program running on Wine, I receive the following error (ERROR_NO_SUCH_DEVICE):

called `Result::unwrap()` on an `Err` value: Os { code: 10047, kind: Uncategorized, message: "OS Error 10047 (FormatMessageW() returned error 317)" }
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src/result.rs:1649:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce\library\core\src\result.rs:1073:23
   4: win_uds_test::main
             at /home/silt/Documents/Programming/Rust/win-uds-test/src/main.rs:3:5
   5: core::ops::function::FnOnce::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce\library\core\src\ops\function.rs:250:5

The test program I'm using is nothing fancy, just

use uds_windows::UnixStream;
fn main() {
    UnixStream::connect(r"Z:\tmp\socket").unwrap();
}

Looking at the output of strace, the path I provide is never even checked, and no socket-related operations are done excepting those from Wine itself.

Any idea what could be going wrong here, or tips on how to proceed with properly debugging this?

Environment info: - OS: `Artix Linux Rolling` - Wine: `wine-ge-proton8-4` (reproduces on all other Wine versions I've tried) - uds_windows: `1.1.0` - rustc: `1.76.0 (07dca489a 2024-02-04)` - Build target: `i686-pc-windows-gnu`
haraldh commented 4 months ago

no clue.. we were testing with unix like file paths.. not windows drives

siltyy commented 4 months ago

UNIX-like file paths, on Windows? I'm a bit confused about what you mean, since I've also tried stuff like /tmp/socket, /z/tmp/socket, \\?\GlobalRoot\Global??\Z:\tmp\socket, \\?\Global\Z:\tmp\socket, and even just \socket and /socket with the socket being at C:\socket thinking maybe this only supported subdirectories of C:, and all of them had the same issue.

siltyy commented 3 months ago

https://github.com/haraldh/rust_uds_windows/blob/fb5e294a1c7430cfacc19e8fad6332a1abb33a95/src/stdnet/mod.rs#L55

Z:\tmp\socket, z:\tmp\socket, and (with the socket in C:'s root) \socket are all valid Win32 file paths as defined by https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file and should work assuming the comment is correct and the code is working correctly.