From b2286dec1cdf89ca29a830ffab84b9759bec0af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B6=BE=E7=80=AC=E6=A1=83=E6=A1=83?= Date: Tue, 10 Nov 2026 02:04:09 +0800 Subject: [PATCH] fix(android): keep why a loose library failed A protected library added on its own whose restore failed reported an empty error list, and its failure profile carried an empty reason in both the route and the profile errors. The report now records the error it already printed, so the text report shows the reason and --json carries it in all three places. --- senbei-io/src/job.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/senbei-io/src/job.rs b/senbei-io/src/job.rs index d01d215..9709f13 100644 --- a/senbei-io/src/job.rs +++ b/senbei-io/src/job.rs @@ -2248,6 +2248,10 @@ fn android_library_input_with_error( let mut entry = InputReport::new(input, Role::Content); entry.status = status; entry.analysis_incomplete = error.is_some_and(analysis_incomplete); + // The failure profile below takes its detail from the first error. + if let Some(error) = error { + entry.error(of_error(error)); + } match status { InputStatus::Ok => { entry.profile = Some(crate::report::android_recovered_profile()); @@ -2947,6 +2951,28 @@ mod incomplete_analysis_tests { assert!(!reported.analysis_incomplete); } + /// A loose library that failed keeps its error, in the report and as the + /// failure profile's detail. + #[test] + fn a_failed_android_library_reports_its_error() { + let td = tempfile::tempdir().unwrap(); + let path = td.path().join("libil2cpp.so"); + std::fs::write(&path, b"not really an ELF").unwrap(); + let error = anyhow::anyhow!("6 unresolved slots").context("restore protected library"); + let reported = android_library_input_with_error( + &path, + InputStatus::Error, + &path, + Instant::now(), + Some(&error), + ); + let texts: Vec<&str> = reported.errors.iter().map(Message::text).collect(); + assert_eq!(texts, ["restore protected library: 6 unresolved slots"]); + let profile = reported.profile.expect("a failure profile"); + let detail: Vec<&str> = profile.errors.iter().map(Message::text).collect(); + assert_eq!(detail, texts); + } + /// A container whose entry hit a ceiling is incomplete as a whole. #[test] fn a_container_inherits_an_incomplete_entry() {