Skip to content

Commit 8154a7f

Browse files
committed
ostree-ext: Stub out config loading if we detect nspawn
Workaround for rpm-software-management/mock#1613 (comment) Signed-off-by: Colin Walters <[email protected]>
1 parent eaa155a commit 8154a7f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

crates/ostree-ext/src/globals.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,14 @@ impl ConfigPaths {
9393
/// Return the path to the global container authentication file, if it exists.
9494
#[context("Loading global authfile")]
9595
pub fn get_global_authfile(root: &Dir) -> Result<Option<(Utf8PathBuf, File)>> {
96-
let root = &RootDir::new(root, ".").context("Opening RootDir")?;
9796
let am_uid0 = rustix::process::getuid() == rustix::process::Uid::ROOT;
97+
// Workaround for https://github.com/rpm-software-management/mock/pull/1613#issuecomment-3421908652
98+
#[cfg(test)]
99+
if !am_uid0 {
100+
return Ok(None);
101+
}
102+
103+
let root = &RootDir::new(root, ".").context("Opening RootDir")?;
98104
get_global_authfile_impl(root, am_uid0)
99105
}
100106

@@ -127,6 +133,7 @@ mod tests {
127133
}
128134

129135
#[test]
136+
#[ignore = "https://github.com/rpm-software-management/mock/pull/1613#issuecomment-3421908652"]
130137
fn test_config_paths() -> Result<()> {
131138
let root = &cap_tempfile::TempDir::new(cap_std::ambient_authority())?;
132139
let rootdir = &RootDir::new(root, ".")?;

0 commit comments

Comments
 (0)