Skip to content

Commit f6bf0fc

Browse files
committed
fix(crate_universe): fix OUTPUT_BASE env var value format in crates_vendor
The OUTPUT_BASE env var override inserted `format!("output_base: {}", path)` as the HashMap value. However, the `bazel info` output parser splits each line on `:` and stores only the part after the colon as the value: let (k, v) = line.split_at(line.find(':')?); Ok((k.to_string(), (v[1..]).trim().to_string())) So for `bazel info` output like "output_base: /data/output", the HashMap contains {"output_base" => "/data/output"}. But the OUTPUT_BASE override stored the FULL formatted string as the value: {"output_base" => "output_base: /data/output"}. When TryFrom later converts this to a PathBuf via `.map(Into::into)`, it produces PathBuf("output_base: /data/output") — an invalid path. This means the OUTPUT_BASE env var has never worked correctly. Fix by storing the raw path string without the prefix.
1 parent 39a22fe commit f6bf0fc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crate_universe/src/cli/vendor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl BazelInfo {
183183
// Allow a predefined environment variable to take precedent. This
184184
// solves for the specific needs of Bazel CI on Github.
185185
if let Ok(path) = env::var("OUTPUT_BASE") {
186-
bazel_info.insert("output_base".to_owned(), format!("output_base: {}", path));
186+
bazel_info.insert("output_base".to_owned(), path);
187187
};
188188

189189
BazelInfo::try_from(bazel_info)

0 commit comments

Comments
 (0)