Docker: Fix cmdbridge init when docker is remote

If the user has specified a remote path for the "docker" executable
it is not possible to simply bind the cmdbridge as its on a different device.

We fall back to copying the cmdbridge in this case.

Task-number: QTCREATORBUG-31364
Change-Id: I03b5594c1c942fe6539a45a32d2a31e24f2a493b
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-08-01 07:10:32 +02:00
parent 86b130f7c0
commit 3cb03be0fd

View File

@@ -604,8 +604,12 @@ DockerDevice::DockerDevice(std::unique_ptr<DockerDeviceSettings> deviceSettings)
return make_unexpected(cmdBridgePath.error());
auto fAccess = std::make_unique<DockerDeviceFileAccess>(d);
expected_str<void> initResult = fAccess->init(
rootPath().withNewPath("/tmp/_qtc_cmdbridge"));
expected_str<void> initResult;
if (!cmdBridgePath->isSameDevice(Docker::Internal::settings().dockerBinaryPath())) {
initResult = fAccess->deployAndInit(Core::ICore::libexecPath(), rootPath());
} else {
initResult = fAccess->init(rootPath().withNewPath("/tmp/_qtc_cmdbridge"));
}
if (!initResult)
return make_unexpected(initResult.error());
@@ -873,7 +877,7 @@ QStringList DockerDevicePrivate::createMountArgs() const
for (const FilePath &m : deviceSettings->mounts())
mounts.append({m, m});
if (cmdBridgePath)
if (cmdBridgePath && cmdBridgePath->isSameDevice(settings().dockerBinaryPath()))
mounts.append({cmdBridgePath.value(), FilePath("/tmp/_qtc_cmdbridge")});
for (const MountPair &mi : mounts) {