Skip to content

Commit 8b4f28c

Browse files
committed
Partial fix for running udc-qpr-dev with host_substitution=all
This accommodates the different file names in udc-qpr-dev. There is an outstanding issue that run_cvd passes new flags to crosvm that don't exist in the udc-dev version of crosvm, specifically: ``` log_tee(2421652) I 03-20 15:54:15 2421652 2421652 log_tee.cpp:167] [2026-03-20T15:54:15.353288776-07:00 INFO crosvm] crosvm started. log_tee(2421652) E 03-20 15:54:15 2421652 2421652 log_tee.cpp:158] [2026-03-20T15:54:15.353444901-07:00 ERROR crosvm] arg parsing failed: Unrecognized argument: --vhost-user log_tee(2421652) E 03-20 15:54:15 2421652 2421652 log_tee.cpp:158] log_tee(2421652) E 03-20 15:54:15 2421652 2421652 log_tee.cpp:158] [2026-03-20T15:54:15.353464208-07:00 INFO crosvm] invalid argument run_cvd(2421601) I 03-20 15:54:15 2421604 2421604 process_monitor.cc:81] Detected unexpected exit of monitored subprocess /var/tmp/cvd/270178/1774047250279517/artifacts/host_tools/bin/process_restarter run_cvd(2421601) I 03-20 15:54:15 2421604 2421604 process_monitor.cc:83] Subprocess /var/tmp/cvd/270178/1774047250279517/artifacts/host_tools/bin/process_restarter (2421653) has exited with exit code 35 log_tee(2421668) I 03-20 15:54:15 2421668 2421668 log_tee.cpp:167] [2026-03-20T15:54:15.356759303-07:00 INFO crosvm] crosvm started. log_tee(2421668) E 03-20 15:54:15 2421668 2421668 log_tee.cpp:158] [2026-03-20T15:54:15.356936379-07:00 ERROR crosvm] arg parsing failed: Unrecognized argument: --vhost-user-connect-timeout-ms log_tee(2421668) E 03-20 15:54:15 2421668 2421668 log_tee.cpp:158] log_tee(2421668) E 03-20 15:54:15 2421668 2421668 log_tee.cpp:158] [2026-03-20T15:54:15.356955304-07:00 INFO crosvm] invalid argument run_cvd(2421601) I 03-20 15:54:15 2421604 2421604 process_monitor.cc:81] Detected unexpected exit of monitored subprocess /var/tmp/cvd/270178/1774047250279517/artifacts/host_tools/bin/process_restarter run_cvd(2421601) I 03-20 15:54:15 2421604 2421604 process_monitor.cc:83] Subprocess /var/tmp/cvd/270178/1774047250279517/artifacts/host_tools/bin/process_restarter (2421679) has exited with exit code 35 run_cvd(2421601) E 03-20 15:54:15 2421604 2421604 process_monitor.cc:143] Stopping all monitored processes due to unexpected exit of critical process ``` Repro command: ``` bazel run //cuttlefish/package:cvd -- fetch \ --default_build=git_udc-qpr-dev/cf_x86_64_phone-userdebug \ --target_directory=$HOME/dl_udc \ --host_substitutions=all bazel run //cuttlefish/package:cvd -- create \ --host_path=$HOME/dl_udc \ --product_path=$HOME/dl_udc \ --host_substitutions=all ``` Bug: b/494662475
1 parent cba818f commit 8b4f28c

3 files changed

Lines changed: 31 additions & 10 deletions

File tree

base/cvd/cuttlefish/host/commands/cvd/fetch/substitute.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Result<void> Substitute(const std::string& target,
6161
return {};
6262
}
6363

64+
CF_EXPECT(EnsureDirectoryExists(android::base::Dirname(full_link_name)));
65+
6466
if (FileExists(full_link_name)) {
6567
CF_EXPECTF(unlink(full_link_name.c_str()) == 0, "{}", StrError(errno));
6668
}
@@ -80,17 +82,15 @@ Result<void> SubstituteWithFlag(
8082
if (host_substitutions == std::vector<std::string>{"all"}) {
8183
auto callback = [&bin_dir_parent,
8284
&target_dir](const std::string& path) -> Result<void> {
85+
if (IsDirectory(path)) {
86+
return {};
87+
}
8388
std::string_view local_path(path);
8489
CF_EXPECTF(android::base::ConsumePrefix(&local_path, bin_dir_parent),
8590
"Unexpected prefix in : '{}'", local_path);
8691

8792
const std::string to_substitute = target_dir + std::string(local_path);
88-
if (FileExists(to_substitute) && !IsDirectory(to_substitute)) {
89-
CF_EXPECTF(unlink(to_substitute.c_str()) >= 0,
90-
"Failed to unlink '{}': '{}'", to_substitute,
91-
StrError(errno));
92-
CF_EXPECT(Symlink(path, to_substitute));
93-
}
93+
CF_EXPECT(Substitute(path, to_substitute));
9494
return {};
9595
};
9696
CF_EXPECT(WalkDirectory(bin_dir_parent, callback));

base/cvd/cuttlefish/host/libs/config/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,10 @@ cf_cc_library(
367367
name = "known_paths",
368368
srcs = ["known_paths.cpp"],
369369
hdrs = ["known_paths.h"],
370-
deps = ["//cuttlefish/host/libs/config:config_utils"],
370+
deps = [
371+
"//cuttlefish/common/libs/utils:files",
372+
"//cuttlefish/host/libs/config:config_utils",
373+
],
371374
)
372375

373376
cf_cc_library(

base/cvd/cuttlefish/host/libs/config/known_paths.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <string>
2020

21+
#include "cuttlefish/common/libs/utils/files.h"
2122
#include "cuttlefish/host/libs/config/config_utils.h"
2223

2324
namespace cuttlefish {
@@ -28,7 +29,14 @@ std::string AutomotiveProxyBinary() {
2829
return HostBinaryPath("automotive_vsock_proxy");
2930
}
3031

31-
std::string AvbToolBinary() { return HostBinaryPath("avbtool.py"); }
32+
std::string AvbToolBinary() {
33+
const std::string py_ext = HostBinaryPath("avbtool.py");
34+
if (FileExists(py_ext)) {
35+
return py_ext;
36+
} else {
37+
return HostBinaryPath("avbtool");
38+
}
39+
}
3240

3341
std::string CasimirBinary() { return HostBinaryPath("casimir"); }
3442

@@ -156,15 +164,25 @@ std::string TestKeyRsa2048() {
156164
}
157165

158166
std::string TestKeyRsa4096() {
159-
return DefaultHostArtifactsPath("etc/cvd_avb_testkey_rsa4096.pem");
167+
const std::string rsa_4096 = DefaultHostArtifactsPath("etc/cvd_avb_testkey_rsa4096.pem");
168+
if (FileExists(rsa_4096)) {
169+
return rsa_4096;
170+
} else {
171+
return DefaultHostArtifactsPath("etc/cvd_avb_testkey.pem");
172+
}
160173
}
161174

162175
std::string TestPubKeyRsa2048() {
163176
return DefaultHostArtifactsPath("etc/cvd_rsa2048.avbpubkey");
164177
}
165178

166179
std::string TestPubKeyRsa4096() {
167-
return DefaultHostArtifactsPath("etc/cvd_rsa4096.avbpubkey");
180+
const std::string rsa_4096 = DefaultHostArtifactsPath("etc/cvd_rsa4096.avbpubkey");
181+
if (FileExists(rsa_4096)) {
182+
return rsa_4096;
183+
} else {
184+
return DefaultHostArtifactsPath("etc/cvd.avbpubkey");
185+
}
168186
}
169187

170188
std::string TombstoneReceiverBinary() {

0 commit comments

Comments
 (0)