context: fix deadlock and panics when resolving parented contexts
set_current held the config RwLock for writing across make_context, which for a context with a parent re-entered the same lock through Context::new's global-manager lookup, deadlocking 'pkh context use'. Context building is now lock-free by construction: make_context resolves parent chains against a snapshot map (also rejecting parent cycles), and neither set_current nor remove_context holds a guard while building a Context. A corrupt contexts.json no longer aborts every command at manager init: load falls back to the default local-only config, backs the corrupt file up to contexts.json.bak so a later save cannot silently destroy it, and a dangling current/parent context falls back to local with an error log instead of panicking.
This commit is contained in:
+1
-1
@@ -717,7 +717,7 @@ mod tests {
|
||||
"Types: deb\nURIs: http://a\nSuites: noble\nComponents: main\n",
|
||||
)
|
||||
.unwrap();
|
||||
let ctx = Arc::new(Context::new(ContextConfig::Local));
|
||||
let ctx = Arc::new(Context::new(ContextConfig::Local).unwrap());
|
||||
|
||||
let origin = SourceOrigin {
|
||||
path: path.clone(),
|
||||
|
||||
Reference in New Issue
Block a user