From 3b28fc65f5de7c6ad69bee48b2d1f52dd9b30972 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 29 Jun 2026 02:16:43 +0900 Subject: fix(advisory): pass IO as shared handle to Auditor::audit Auditor::audit took io as &mut dyn IOInterface, forcing the audit and installer post-audit call sites to hold a borrow_mut() on the shared IO RefCell for the whole call. During advisory fetching the repositories write to their own clones of the same handle, so the borrow_mut() collided with their borrow() and panicked with 'RefCell already mutably borrowed' on 'audit --locked'. Take the Rc> handle instead so writes borrow briefly and never overlap. Un-ignore the locked-audit regression test that this unblocks. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/command/diagnose_command.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/command/diagnose_command.rs') diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs index a465182..0c50d69 100644 --- a/crates/shirabe/src/command/diagnose_command.rs +++ b/crates/shirabe/src/command/diagnose_command.rs @@ -996,9 +996,11 @@ impl DiagnoseCommand { )?); repo_set.add_repository(composer_repo_as_repo)?; - let mut io = BufferIO::new(String::new(), 0, None)?; + let io: std::rc::Rc> = std::rc::Rc::new( + std::cell::RefCell::new(BufferIO::new(String::new(), 0, None)?), + ); let result = match auditor.audit( - &mut io, + &io, &repo_set, packages, Auditor::FORMAT_TABLE, @@ -1022,7 +1024,11 @@ impl DiagnoseCommand { return Ok(PhpMixed::String(format!( "Audit found some issues:{}{}", PHP_EOL, - io.get_output() + io.borrow() + .as_any() + .downcast_ref::() + .unwrap() + .get_output() ))); } -- cgit v1.3.1