cee25393d8
- Fix P15-8-init-cycle-detection.patch: replace visiting+error with seen+silent-skip to eliminate 11 false-positive 'dependency cycle detected' errors on shared deps - Fix P0-daemon-fix-init-notify-unwrap.patch: remove eprintln! for missing INIT_NOTIFY (expected for oneshot_async services, ~7 daemons affected) - Fix driver-manager hotplug loop: add PERMANENTLY_SKIPPED static set shared between hotplug handler and DriverConfig::probe() to stop infinite re-probing of Fatal/NotSupported/deferred-exhausted device+driver pairs (e.g. ided) - Fix driver-manager log_timeline: suppress repeated EPIPE/ENOENT errors with AtomicI32 dedup and AtomicBool one-shot guards for boot timeline JSON - Add driver-manager SIGTERM handler, ACPI bus registration, --status mode, driver reap loop, graceful shutdown, and reduced deferred retries (30→3)
35 lines
1.4 KiB
Diff
35 lines
1.4 KiB
Diff
--- a/init/src/unit.rs
|
|
+++ b/init/src/unit.rs
|
|
@@ -1,4 +1,4 @@
|
|
-use std::collections::BTreeMap;
|
|
+use std::collections::{BTreeMap, BTreeSet};
|
|
use std::path::{Path, PathBuf};
|
|
use std::{fs, io};
|
|
|
|
@@ -76,7 +76,12 @@
|
|
|
|
pub fn load_units(&mut self, root_unit: UnitId, errors: &mut Vec<String>) -> Vec<UnitId> {
|
|
let mut loaded_units = vec![];
|
|
- let mut pending_units = vec![root_unit];
|
|
+ let mut pending_units = vec![root_unit.clone()];
|
|
+ // Track all units ever seen (queued or loaded) to avoid re-queuing.
|
|
+ // A true cycle exists only when a unit depends on itself through its
|
|
+ // ancestor chain, not when two independent units share a dependency.
|
|
+ let mut seen = BTreeSet::new();
|
|
+ seen.insert(root_unit);
|
|
|
|
while let Some(unit_id) = pending_units.pop() {
|
|
if self.units.contains_key(&unit_id) {
|
|
@@ -86,6 +91,11 @@
|
|
if let Some(unit) = unit {
|
|
loaded_units.push(unit.clone());
|
|
for dep in &self.unit(&unit).info.requires_weak {
|
|
+ // If the dependency is already loaded or already queued,
|
|
+ // it's a shared dependency — not a cycle. Skip it.
|
|
+ if !seen.insert(dep.clone()) {
|
|
+ continue;
|
|
+ }
|
|
pending_units.push(dep.clone());
|
|
}
|
|
}
|