Confine package ownership changes to private mounts

This commit is contained in:
ms2k 2026-07-27 03:31:58 +09:00
commit 8334fd379f

View file

@ -275,8 +275,23 @@ impl IgnoredWorkspace {
let stat = match backing {
Classification::Host => host,
Classification::Isolated => isolated,
}
.ok_or_else(|| io::Error::from_raw_os_error(libc::ENOENT))?;
};
let (backing, stat) = if let Some(stat) = stat {
(backing, stat)
} else if backing == Classification::Isolated
&& host.as_ref().is_some_and(|stat| {
stat.st_mode & libc::S_IFMT == libc::S_IFDIR
&& self
.provenance
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner)
.matches(path, &crate::migration::ObjectStamp::from_stat(stat))
})
{
(Classification::Host, host.expect("checked host directory"))
} else {
return Err(io::Error::from_raw_os_error(libc::ENOENT));
};
Ok(ResolvedEntry {
path: path.to_path_buf(),
backing,