Skip to content

Commit 80737a7

Browse files
committed
ostree-ext: Add .context for some more errors
This suddenly started in our RPM (COPR/mock) builds, my suspicion is that seccomp got turned on inadvertently, but let's add some error context here on general principle. ``` thread 'boundimage::tests::test_parse_spec_dir' panicked at crates/lib/src/boundimage.rs:290:49: called `Result::unwrap()` on an `Err` value: Querying bound images Caused by: Function not implemented (os error 38) note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Signed-off-by: Colin Walters <[email protected]>
1 parent 02ecf37 commit 80737a7

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

crates/ostree-ext/src/globals.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Module containing access to global state.
22
33
use super::Result;
4+
use anyhow::Context;
45
use camino::{Utf8Path, Utf8PathBuf};
56
use cap_std_ext::cap_std::fs::Dir;
67
use cap_std_ext::RootDir;
@@ -61,17 +62,26 @@ impl ConfigPaths {
6162
let p = p.as_ref();
6263
let mut runtime = self.runtime.clone();
6364
runtime.push(p);
64-
if let Some(f) = root.open_optional(&runtime)? {
65+
if let Some(f) = root
66+
.open_optional(&runtime)
67+
.context("Opening runtime auth file")?
68+
{
6569
return Ok(Some((runtime, f)));
6670
}
6771
let mut persistent = self.persistent.clone();
6872
persistent.push(p);
69-
if let Some(f) = root.open_optional(&persistent)? {
73+
if let Some(f) = root
74+
.open_optional(&persistent)
75+
.context("Opening persistent auth file")?
76+
{
7077
return Ok(Some((persistent, f)));
7178
}
7279
if let Some(mut system) = self.system.clone() {
7380
system.push(p);
74-
if let Some(f) = root.open_optional(&system)? {
81+
if let Some(f) = root
82+
.open_optional(&system)
83+
.context("Opening system auth file")?
84+
{
7585
return Ok(Some((system, f)));
7686
}
7787
}
@@ -80,8 +90,9 @@ impl ConfigPaths {
8090
}
8191

8292
/// Return the path to the global container authentication file, if it exists.
93+
#[context("Loading global authfile")]
8394
pub fn get_global_authfile(root: &Dir) -> Result<Option<(Utf8PathBuf, File)>> {
84-
let root = &RootDir::new(root, ".")?;
95+
let root = &RootDir::new(root, ".").context("Opening RootDir")?;
8596
let am_uid0 = rustix::process::getuid() == rustix::process::Uid::ROOT;
8697
get_global_authfile_impl(root, am_uid0)
8798
}

0 commit comments

Comments
 (0)