Commit 60036d4
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.
Also extract `parse_bazel_info` from `try_new` so the parsing and env
var override logic can be unit-tested without spawning a subprocess.1 parent 39a22fe commit 60036d4
1 file changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
171 | 177 | | |
172 | 178 | | |
173 | 179 | | |
| |||
183 | 189 | | |
184 | 190 | | |
185 | 191 | | |
186 | | - | |
| 192 | + | |
187 | 193 | | |
188 | 194 | | |
189 | 195 | | |
| |||
409 | 415 | | |
410 | 416 | | |
411 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
412 | 435 | | |
0 commit comments