Skip to content

Commit 28e24c2

Browse files
committed
install: Move warning after state and possible re-exec
I'm not sure if this fell out of a refactoring or not, but right now we end up emitting the warning here twice in the case that we re-exec the current process in order to get the right SELinux label. It's unfortunately a bit hard to truly minimize the set of things we do before `prepare_install`, so we'll just have to be mindful. Signed-off-by: Colin Walters <[email protected]>
1 parent a15090b commit 28e24c2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/src/install.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,14 +1442,18 @@ pub(crate) async fn install_to_filesystem(
14421442
anyhow::bail!("Not a mountpoint: {root_path}");
14431443
}
14441444

1445+
// Gather global state, destructuring the provided options.
1446+
// IMPORTANT: We might re-execute the current process in this function (for SELinux among other things)
1447+
// IMPORTANT: and hence anything that is done before MUST BE IDEMPOTENT.
1448+
// IMPORTANT: In practice, we should only be gathering information before this point,
1449+
// IMPORTANT: and not performing any mutations at all.
1450+
let state = prepare_install(opts.config_opts, opts.source_opts, opts.target_opts).await?;
1451+
14451452
// Check to see if this happens to be the real host root
14461453
if !fsopts.acknowledge_destructive {
14471454
warn_on_host_root(&rootfs_fd)?;
14481455
}
14491456

1450-
// Gather global state, destructuring the provided options
1451-
let state = prepare_install(opts.config_opts, opts.source_opts, opts.target_opts).await?;
1452-
14531457
match fsopts.replace {
14541458
Some(ReplaceMode::Wipe) => {
14551459
let rootfs_fd = rootfs_fd.try_clone()?;

0 commit comments

Comments
 (0)