https://bugs.winehq.org/show_bug.cgi?id=52568
Bug ID: 52568 Summary: Support for AF_UNIX is missing Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winsock Assignee: wine-bugs@winehq.org Reporter: ralf.habacker@freenet.de Distribution: ---
Newer Windows 10 builds supports AF_UNIX, see https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/ for details.
There have been unfinished attempts to incorporate such support into wine, see https://www.winehq.org/pipermail/wine-devel/2021-May/187049.html.
https://bugs.winehq.org/show_bug.cgi?id=52568
--- Comment #1 from Austin English austinenglish@gmail.com --- Do you have a sample/target application that needs this?
https://bugs.winehq.org/show_bug.cgi?id=52568
--- Comment #2 from Ralf Habacker ralf.habacker@freenet.de --- There are plans to add unix socket support to DBus for Windows (see https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/249#note_1267962) and the related CI system uses wine to run the cross compiled DBus test suite.
https://bugs.winehq.org/show_bug.cgi?id=52568
--- Comment #3 from Ralf Habacker ralf.habacker@freenet.de --- (In reply to Ralf Habacker from comment #2)
There are plans to add unix socket support to DBus for Windows (see https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/249#note_1267962) and the related CI system uses wine to run the cross compiled DBus test suite.
After https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/249 was integrated into dbus master, support for Unix domain sockets on Windows has recently become available in dbus, but cannot be tested with wine yet.
https://bugs.winehq.org/show_bug.cgi?id=52568
--- Comment #4 from Ralf Habacker ralf.habacker@freenet.de --- At https://www.winehq.org/pipermail/wine-devel/2021-May/187049.html a minimal implementation has been published.
https://bugs.winehq.org/show_bug.cgi?id=52568
--- Comment #5 from Ralf Habacker ralf.habacker@freenet.de --- (In reply to Austin English from comment #1)
Do you have a sample/target application that needs this?
The use of Unix domain sockets on Windows is available for dbus from version 1.15.0, released on 2022-09-22.
https://bugs.winehq.org/show_bug.cgi?id=52568
--- Comment #6 from Ralf Habacker ralf.habacker@freenet.de --- Created attachment 73974 --> https://bugs.winehq.org/attachment.cgi?id=73974 testcase from dbus binaries
how to reproduce a working support:
1. download test case 2. unpack test case 7z x dbus-1.15.4-2023-01-31.7z cd dbus-1.15.4-2023-01-31
3. to see that the server binds and listens on the Unix domain socket, execute:
DBUS_VERBOSE=1 wine dbus-daemon.exe --config-file=$PWD/session.conf
Look for lines with "_dbus_server_init_base] Initialized server on address - ....
If you see "unix:..." then Unix domain sockets are used, if you see "tcp:host=..." then Unix domain sockets are not available (This is determined via a call to socket())
4. to see the client connect to the Unix domain socket and exchange data, run:
wine dbus-daemon.exe --config-file=$PWD/session.conf & DBUS_VERBOSE=1 DBUS_SESSION_BUS_ADDRESS= wine dbus-monitor.exe
See for [dbus/dbus-transport.c(206):_dbus_transport_init_base] Initialised transport on address .....
If you see "unix:..." here, then the connection to the server is established via a Unix domain socket.
5. a data exchange is possible when calling DBUS_SESSION_BUS_ADDRESS= wine ./dbus-monitor.exe
can be seen in the output
dbus-daemon[32]: info: [session pid=32 sid=S-1-5-21-0-0-1000] Connection :1.2 (pid=304 comm="" sid="S-1-5-21-0-0-1000") became a monitor. signal time=1675164565.625070 sender=org.freedesktop.DBus -> destination=:1.2 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired string ":1.2" signal time=1675164565.626518 sender=org.freedesktop.DBus -> destination=:1.2 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost string ":1.2"
https://bugs.winehq.org/show_bug.cgi?id=52568
--- Comment #7 from Ralf Habacker ralf.habacker@freenet.de --- (In reply to Ralf Habacker from comment #4)
At https://www.winehq.org/pipermail/wine-devel/2021-May/187049.html a minimal implementation has been published.
The patch unfortunately does not contain the adjustments for the conversion of the socket path from Windows to Unix to the reverse https://gitlab.winehq.org/wine/wine/-/blob/master/server/sock.c#L480 https://gitlab.winehq.org/wine/wine/-/blob/master/server/sock.c#L555 in the wine server, where the underlying calls are made. The particular problem here is that - as far as I know - no Windows API calls are possible here and the available function for converting are only available at Windows level.
https://bugs.winehq.org/show_bug.cgi?id=52568
--- Comment #8 from Ralf Habacker ralf.habacker@freenet.de --- Created attachment 74092 --> https://bugs.winehq.org/attachment.cgi?id=74092 Smaller test case for afunix sockets
The appended zip file contains binaries and source for a smaller test case.
After unpacking the zip file, running the executable test-socket-afunix-raw.exe shows on native Windows:
# No test data! ok 1 - initial nss query did not leak memory # Running test: test dbus unix socket raw # AF_UNIX stream socket created for server # AF_UNIX stream socket created for client # AF_UNIX socket file did not exist # Listening on AF_UNIX server socket # Connected to AF_UNIX server socket # AF_UNIX server accepted connection # AF_UNIX server socket filepath: 'tpf_unix_sock.server' # Accepted AF_UNIX socket filepath: 'tpf_unix_sock.server' # Client AF_UNIX socket filepath: '' # Sending data over AF_UNIX socket ... # Data sent! # Waiting to read data from AF_UNIX socket ... # Data from AF_UNIX socket received = 'Hello from server' ok 2 - test dbus unix socket raw # test dbus unix socket raw test took 0 seconds # 2 tests passed (0 skipped) 1..2
while with with wine 8.2
# No test data! ok 1 - initial nss query did not leak memory # Running test: test dbus unix socket raw ok 2 # SKIP No AFUNIX support available # unlink AF_UNIX socket file failure: 2 '' ok 3 - test dbus unix socket raw # test dbus unix socket raw test took 0 seconds # 2 tests passed (1 skipped) 1..3
https://bugs.winehq.org/show_bug.cgi?id=52568
Richard W.M. Jones rjones@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |rjones@redhat.com
--- Comment #9 from Richard W.M. Jones rjones@redhat.com --- (In reply to Ralf Habacker from comment #7)
(In reply to Ralf Habacker from comment #4)
At https://www.winehq.org/pipermail/wine-devel/2021-May/187049.html a minimal implementation has been published.
The patch unfortunately does not contain the adjustments for the conversion of the socket path from Windows to Unix to the reverse https://gitlab.winehq.org/wine/wine/-/blob/master/server/sock.c#L480 https://gitlab.winehq.org/wine/wine/-/blob/master/server/sock.c#L555 in the wine server, where the underlying calls are made. The particular problem here is that - as far as I know - no Windows API calls are possible here and the available function for converting are only available at Windows level.
https://www.winehq.org/mailman3/hyperkitty/list/wine-devel@winehq.org/thread...
https://bugs.winehq.org/show_bug.cgi?id=52568
--- Comment #10 from Ralf Habacker ralf.habacker@freenet.de --- (In reply to Richard W.M. Jones from comment #9)
https://www.winehq.org/mailman3/hyperkitty/list/wine-devel@winehq.org/thread... CWFIHT4ZP5WG7FKFZZWO4W7L477BFEKJ/
However none of this seems to work inside wineserver (I guess because it's not part of the "Windows world"). I cannot work out the
<equivalent of this for wineserver, or if there's something else I
should be doing, such as converting the path before it is sent to wineserver.
I got a few steps further by adding an additional (but incomplete) implementation of converting paths to wineserver (see https://gitlab.winehq.org/rhabacker/wine/-/tree/issue-52568)
Since the corresponding functions are only available on the Windows side, another option would be to determine the Unix path on the Windows side and to pass it to the wineserver in addition to the Unix path, so that it has both available.