Skip to content

install: Avoid context-per-recursion #1233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,6 @@ fn require_empty_rootdir(rootfs_fd: &Dir) -> Result<()> {
/// Remove all entries in a directory, but do not traverse across distinct devices.
/// If mount_err is true, then an error is returned if a mount point is found;
/// otherwise it is silently ignored.
#[context("Removing entries (noxdev)")]
fn remove_all_in_dir_no_xdev(d: &Dir, mount_err: bool) -> Result<()> {
for entry in d.entries()? {
let entry = entry?;
Expand Down Expand Up @@ -1623,15 +1622,16 @@ fn clean_boot_directories(rootfs: &Dir, is_ostree: bool) -> Result<()> {
.context("removing bootupd-state.json")?;
} else {
// This should not remove /boot/efi note.
remove_all_in_dir_no_xdev(&bootdir, false)?;
remove_all_in_dir_no_xdev(&bootdir, false).context("Emptying /boot")?;
// TODO: Discover the ESP the same way bootupd does it; we should also
// support not wiping the ESP.
if ARCH_USES_EFI {
if let Some(efidir) = bootdir
.open_dir_optional(crate::bootloader::EFI_DIR)
.context("Opening /boot/efi")?
{
remove_all_in_dir_no_xdev(&efidir, false)?;
remove_all_in_dir_no_xdev(&efidir, false)
.context("Emptying EFI system partition")?;
}
}
}
Expand Down