diff --git a/rust/tool/shared/src/utils.rs b/rust/tool/shared/src/utils.rs index 4ca649cf..11ffa6b4 100644 --- a/rust/tool/shared/src/utils.rs +++ b/rust/tool/shared/src/utils.rs @@ -34,6 +34,7 @@ impl SecureTempDirExt for TempDir { fn create_secure_file(&self, path: &Path) -> Result { fs::OpenOptions::new() .create(true) + .truncate(true) .write(true) .mode(0o600) .open(path) diff --git a/rust/tool/systemd/src/architecture.rs b/rust/tool/systemd/src/architecture.rs index 173f1483..fdf61de9 100644 --- a/rust/tool/systemd/src/architecture.rs +++ b/rust/tool/systemd/src/architecture.rs @@ -4,15 +4,10 @@ use lanzaboote_tool::architecture::Architecture; /// Systemd-specific architecture helpers pub trait SystemdArchitectureExt { - fn systemd_stub_filename(&self) -> PathBuf; fn systemd_filename(&self) -> PathBuf; } impl SystemdArchitectureExt for Architecture { - fn systemd_stub_filename(&self) -> PathBuf { - format!("linux{}.efi.stub", self.efi_representation()).into() - } - fn systemd_filename(&self) -> PathBuf { format!("systemd-boot{}.efi", self.efi_representation()).into() } diff --git a/rust/tool/systemd/tests/common/mod.rs b/rust/tool/systemd/tests/common/mod.rs index 5fb09a09..08946cc5 100644 --- a/rust/tool/systemd/tests/common/mod.rs +++ b/rust/tool/systemd/tests/common/mod.rs @@ -20,7 +20,6 @@ use sha2::{Digest, Sha256}; use tempfile::TempDir; use lanzaboote_tool::architecture::Architecture; -use lzbt_systemd::architecture::SystemdArchitectureExt; /// Returns the host platform system /// in the system double format for @@ -98,7 +97,7 @@ pub fn setup_generation_link_from_toplevel( /// Accepts the temporary directory as a parameter so that the invoking function retains control of /// it (and when it goes out of scope). pub fn setup_toplevel(tmpdir: &Path) -> Result { - let system = Architecture::from_nixos_system(SYSTEM)?; + let architecture = Architecture::from_nixos_system(SYSTEM)?; // Generate a random toplevel name so that multiple toplevel paths can live alongside each // other in the same directory. @@ -107,7 +106,7 @@ pub fn setup_toplevel(tmpdir: &Path) -> Result { fs::create_dir_all(&fake_store_path)?; let test_systemd = systemd_location_from_env()?; - let systemd_stub_filename = system.systemd_stub_filename(); + let systemd_stub_filename = systemd_stub_filename(&architecture); let test_systemd_stub = format!( "{test_systemd}/lib/systemd/boot/efi/{systemd_stub_filename}", systemd_stub_filename = systemd_stub_filename.display() @@ -146,9 +145,9 @@ pub fn lanzaboote_install( ) -> Result { // To simplify the test setup, we use the systemd stub here instead of the lanzaboote stub. See // the comment in setup_toplevel for details. - let system = Architecture::from_nixos_system(SYSTEM)?; + let architecture = Architecture::from_nixos_system(SYSTEM)?; let test_systemd = systemd_location_from_env()?; - let systemd_stub_filename = system.systemd_stub_filename(); + let systemd_stub_filename = systemd_stub_filename(&architecture); let test_systemd_stub = format!( "{test_systemd}/lib/systemd/boot/efi/{systemd_stub_filename}", systemd_stub_filename = systemd_stub_filename.display() @@ -259,3 +258,7 @@ pub fn image_path(esp: &TempDir, version: u64, toplevel: &Path) -> Result PathBuf { + format!("linux{}.efi.stub", architecture.efi_representation()).into() +} diff --git a/rust/uefi/rust-toolchain.toml b/rust/uefi/rust-toolchain.toml index 6db27e04..50ba0d51 100644 --- a/rust/uefi/rust-toolchain.toml +++ b/rust/uefi/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.75.0" +channel = "1.78.0" components = [ "rust-src" ] targets = [ "x86_64-unknown-uefi", "aarch64-unknown-uefi" ]