Commit Graph

17 Commits

Author SHA1 Message Date
Ilya.Kazakevich
ae0ed41348 [wslproxy]: survive closed socket, close socket correctly.
1.When remote side socket is closed, `SIGPIPE` might be sent. We must ignore and exit correctly (we can't die as we might accept more connections)

2. shutdown and close sockets will inform remote side that socket is closed. Without it, remote side may not notice anything until the next write.

GitOrigin-RevId: 51a6204651e49f63ac8b52d9e3e1e4928007c3ff
2024-05-01 21:06:34 +00:00
Ilya.Kazakevich
1ad4002475 CPP-35902: Fix SHELL variable when running under WSL with ttyfix
Due to https://github.com/microsoft/WSL/issues/10718 `SHELL` var is set to `ttyfix` breaking `gdb`.

We now:
1. Check if first argument (command to execute) is a valid shell and set `SHELL` accordingly
2. If not, check user default shell. Be it a valid shell, we use it
3. Unset `SHELL` otherwise

Review:
https://jetbrains.team/p/ij/reviews/118965/timeline

GitOrigin-RevId: 425b6886b4b48e29f653413c62326afa8033c694
2023-11-07 03:03:04 +00:00
Ilya.Kazakevich
5ac166f9bc wsltools: strip binaries to decrease size a little
GitOrigin-RevId: eacc71baa8de941c34fad1abe4eb101784806fca
2023-11-06 21:02:52 +00:00
Ilya.Kazakevich
44be55aeee IDEA-333736: Fix tty size for WSL
The problem:
https://github.com/microsoft/WSL/issues/10701

When stdout/err are redirected, WSL reports tty size as 1x1 which breaks `ps` tool (famous "expect trouble" message) that some people might have in profile.

`ttyfix` explicitly sets tty size and inserted by `WslDistribution`.

Tiny refactoring moved `getToolPath` to reuse it


Merge-request: KT-MR-12821
Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com>

GitOrigin-RevId: f33a906b139d22ecdaf0f1b0616ecaaf7bebdd16
2023-11-03 15:35:26 +00:00
Maxat Mansurov
29da655cee RUBY-31136 add option to WslSync for creating stubs for filtered out files.
(cherry picked from commit fdadb26083074b6e510df5c8b66bb3ee13bdb8c3)

IJ-CR-105378

GitOrigin-RevId: b5d0d16b1bba3802191775d9400b23205242238f
2023-03-27 21:47:10 +00:00
Ilya.Kazakevich
eb7bca7328 PY-59608: Support `wslproxy` when routing is broken by VPN.
fixup! PY-59608: Support ``wslproxy`` when routing is broken by VPN.

When user runs VPN with default gateway pointing to the VPN server and configures interface weight, we can't connect to WSL using its egress IP (traffic to ``172.0.0.0/8`` goes to VPN instead of WSL).

With ``wsl.proxy.connect.localhost`` enabled in registry we bind ``wslproxy`` to ``127.0.0.1`` which could be used in latest WSL2 to connect from Windows to Linux. It is a little bit slow, but still works.

fixup! PY-59608: Support ``wslproxy`` when routing is broken by VPN.
PY-59608: Support ``wslproxy`` when routing is broken by VPN.

When user runs VPN with default gateway pointing to the VPN server and configures interface weight, we can't connect to WSL using its egress IP (traffic to ``172.0.0.0/8`` goes to VPN instead of WSL).

With ``wsl.proxy.connect.localhost`` enabled in registry we bind ``wslproxy`` to ``127.0.0.1`` which could be used in latest WSL2 to connect from Windows to Linux. It is a little bit slow, but still works.


Co-authored-by: Vladimir Lagunov <vladimir.lagunov@jetbrains.com>

Merge-request: IJ-MR-105285
Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com>

GitOrigin-RevId: 74b5ad4df9c5e95ca4ef53a465f07855a92aa324
2023-03-24 19:15:50 +00:00
Maxat Mansurov
c688145a99 RUBY-29825 add a separate Makefile.cross for easier cross-compilation to other platforms.
By default, we cross-compile for `aarch64`, but that could be adjusted via `HOST` variable.

Also cleaned up the `Makefile` and updated README.

Reviewed-by: IJ-CR-102814

GitOrigin-RevId: b65519b2ab6a3461f0e621d5dcc832b083948fef
2023-02-28 15:35:23 +00:00
Maxat Mansurov
8ace063b3b RUBY-29825 fix .gitignore.
Reviewed-by: IJ-CR-102814

GitOrigin-RevId: 791dc21cfb2c602756ae39b63db1571c95fd5e3a
2023-02-28 15:35:20 +00:00
Maxat Mansurov
c609fb1643 RUBY-29825 add support for filters to wslhash.c.
Currently, filters support only includes and excludes of files matching the regex patterns. But it should be fairly easy to extend this with other types of filters in the future.

Reviewed-by: IJ-CR-102814

GitOrigin-RevId: 80b7e33aa4d6f89b8a9279d4aa2648783e363bf4
2023-02-28 15:35:14 +00:00
Maxat Mansurov
61bdde3cfa RUBY-29825 clean up wslhash.c sources.
- fixed uninitialized memory accesses
- use proper boolean constant
- reformat (naming, braces, ...)

Reviewed-by: IJ-CR-102814

GitOrigin-RevId: bf415ab0e135787ab6b99965c1443520c7dd590d
2023-02-28 15:35:11 +00:00
Ilya.Kazakevich
65a8ccb6c5 PY-57058: Skip interfaces with NULL addresses (wslproxy)
``ifaddrs->ifa_addr`` may be NULL according to ``getifaddr(3)``.

This is a case for the tailscale VPN at least

GitOrigin-RevId: 134cd2bcf03a01b6c52536e23b86a1135450d67b
2022-11-02 18:53:01 +00:00
Ilya.Kazakevich
e50e14ed8f Set TCP_NODELAY for `WSLProxy` to disable Nagle for interactivity
GitOrigin-RevId: 60995cbab5ab04ec5c1da3904b7311ead1a52aaf
2022-10-06 15:35:23 +00:00
Ilya.Kazakevich
2ca053a0cc PY-50751: Custom tool for wsl sync: support of dir symlinks
Symlinks on Windows are junctions (since no UAC required), so only directory symlinks are supported.

GitOrigin-RevId: 9f9134d59597d2987a7c1b95602dc6e477651dfb
2022-04-10 15:01:25 +00:00
Ilya.Kazakevich
e23b3dcbc9 PY-50751: Custom rsync for WSL.
``rsync`` is slow because every file system access call from WSL to Windows and vice versa is slow.
We need to decrement number of such calls.

This approach does the following:
* Calculates hashes on Windows side using Intellij process
* Calculates hashes on WSL side using native Linux process
* Compares them searching for differences
* Splits different files into groups, tars each group and copies them on the other side.

From what I checked this is the fastest approach to sync WSL and Windows.

* How to use *

`WslSyncAction` is a temporary internal only action. Run it and try to sync some folder.

`WslSync` is a class with static method you can use to sync to folders.

GitOrigin-RevId: 6c63329d73ff32b7ee5e4436bfde39e72fe35a44
2022-02-04 23:47:52 +00:00
Ilya.Kazakevich
98d767af54 Move WSLProxy to the platform.
WSLProxy helps processes running on WSL connect to Windows bypassing firewall. See WslProxy.kt and wslproxy.c for more info.

GitOrigin-RevId: bb5d0fc0c67ad18ccc2a2c285b5b71f76e00b26b
2021-12-29 13:26:15 +00:00
Ilya.Kazakevich
06462ed710 PY-51679: support several connections to wslproxy.
Ingress port (127.0.0.1:some-port) or WSL must accept several connections.
All of them are forwarded to application port.

Django debug doesn't work without it because it uses several processes, each connected to port on WSL.

See wslproxy.svg and wslproxy.c doc

GitOrigin-RevId: 4623aef93409c1ea8f282908ae0ba8a810652413
2021-12-14 11:26:10 +00:00
Ilya.Kazakevich
9d34c71f5e Download musl for wsltools automatically
This change is required for other wsltools that we will merge to master soon

GitOrigin-RevId: 78ac06777d2ed20137b1b9adf3ee434e14b6b175
2021-12-11 00:59:56 +00:00