Fix plugin cache panic when cwd is unavailable (#18499)

## Summary

Fixes #16637. (I hit this bug after 11h of work on a long-running task.)

Plugin cache initialization could panic when an already-absolute cache
path was normalized through `AbsolutePathBuf::from_absolute_path`,
because that path still consulted `current_dir()`.

This changes absolute-path normalization so already-absolute paths do
not depend on cwd, and makes plugin cache root construction available as
a fallible path through `PluginStore::try_new()`. Plugin cache subpaths
now use `AbsolutePathBuf::join()` instead of re-absolutizing derived
absolute paths.
This commit is contained in:
Eric Traut authored and GitHub committed 2026-04-18 19:04:53 -07:00
1 parent 53b1570367
commit e3f44ca3b3
5 files changed
+80 -20

No files matched your search

@@ -12,6 +12,10 @@ use std::path::Path;
use std::path::PathBuf;
pub(super) fn absolutize(path: &Path) -> std::io::Result<PathBuf> {
if path.is_absolute() {
return Ok(normalize_path(path));
}
Ok(absolutize_from(path, &std::env::current_dir()?))
}