From 54e60147df13213654e47a5848516f46c56dbefa Mon Sep 17 00:00:00 2001 From: "Konstantin.Hudyakov" Date: Mon, 13 Jul 2026 16:01:46 +0300 Subject: [PATCH] [terminal] IJPL-249991 Fix Port Forwarding widget absence on Windows client The problem was in the incorrect socket symlink format we receive from the Linux host on Windows. The roots go deep into details how Unix paths are represented on Windows via EEL API: IJPL-213371. Fix it by mapping the incorrect file path back to the Linux representation. (cherry picked from commit 7411b02732b0aec6d6a5890ebb7e307024ec24a9) IJ-CR-213436 GitOrigin-RevId: a762373d03c956ef970de00af406f4df6ebacb20 --- .../execution/portsWatcher/impl/LinuxPortsScanning.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/platform/execution-impl/src/com/intellij/execution/portsWatcher/impl/LinuxPortsScanning.kt b/platform/execution-impl/src/com/intellij/execution/portsWatcher/impl/LinuxPortsScanning.kt index 708ac2e6c9a9..a6e1873112a3 100644 --- a/platform/execution-impl/src/com/intellij/execution/portsWatcher/impl/LinuxPortsScanning.kt +++ b/platform/execution-impl/src/com/intellij/execution/portsWatcher/impl/LinuxPortsScanning.kt @@ -8,11 +8,13 @@ import com.intellij.openapi.diagnostic.logger import com.intellij.openapi.diagnostic.trace import com.intellij.platform.eel.EelApi import com.intellij.platform.eel.EelDescriptor +import com.intellij.platform.eel.channels.EelDelicateApi import com.intellij.platform.eel.fs.readFile import com.intellij.platform.eel.getOrThrow import com.intellij.platform.eel.isLinux import com.intellij.platform.eel.path.EelPath import com.intellij.platform.eel.provider.asNioPath +import com.intellij.platform.eel.provider.utils.impl.localToIjent import com.intellij.util.io.toByteArray import kotlinx.coroutines.CancellationException import java.nio.file.Files @@ -115,7 +117,14 @@ private fun readLinuxSocketInodesForPid(eelDescriptor: EelDescriptor, pid: Long) catch (_: NoSuchFileException) { continue // Process can be already terminated } - val match = socketInodeRegex.matchEntire(target) ?: continue + // The Linux kernel renders required symlink targets as "socket:[]". + // On a Windows host, however, the WSL 9P layer and IntelliJ's EEL nio provider transliterate ':' + // — illegal in Windows paths — to the private-use char U+F03A (see IJPL-213371), + // so the target arrives as "socket[]". + // Use the `localToIjent` utility to get the correct socket representation (with ':'). + @OptIn(EelDelicateApi::class) + val translatedTarget = localToIjent(target) + val match = socketInodeRegex.matchEntire(translatedTarget) ?: continue val inode = match.groupValues[1].toLongOrNull() ?: continue result.add(inode) }