Skip to content

Commit 53cf2ff

Browse files
committed
fix: Handle repeated set-options-for-source calls before reboot
When set-options-for-source is called multiple times before rebooting, the second call needs to find the target source's previous value in the staged deployment's bootconfig (not the booted BLS, since we haven't rebooted). Without this, the old kargs from the first call would not be removed from the options line, causing duplication. Fix by explicitly checking the target source in the staged bootconfig after iterating known sources from the booted BLS entry. Addresses review feedback from PR #2114. Assisted-by: OpenCode (Claude claude-opus-4-6)
1 parent 2a07a3b commit 53cf2ff

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

crates/lib/src/loader_entries.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,18 @@ pub(crate) fn set_options_for_source_staged(
202202
}
203203
}
204204
}
205+
// Also check the target source directly in the staged bootconfig.
206+
// This handles the case where set-options-for-source was called
207+
// multiple times before rebooting: the target source exists in the
208+
// staged bootconfig but not in the booted BLS entry.
209+
let target_key = format!("{OPTIONS_SOURCE_KEY_PREFIX}{source}");
210+
if !sources.contains_key(source) {
211+
if let Some(val) = bootconfig.get(&target_key) {
212+
if !val.is_empty() {
213+
sources.insert(source.to_string(), CmdlineOwned::from(val.to_string()));
214+
}
215+
}
216+
}
205217
sources
206218
} else {
207219
// For booted deployments, parse the BLS file directly

0 commit comments

Comments
 (0)