From 53eb3225602f0f675e999968821b782caf36c7f8 Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Tue, 5 Nov 2024 10:05:57 +0100 Subject: [PATCH 1/5] Use relative directory for obj files hash When producing `.o` files, the absolute path of each source file is hashed and used as a prefix for the output object files. While this avoids clashes between different source files with the same basenames, this causes determinism issues in the build as the full system path influences the build output. This change strips the out_dir parent from the source file paths, assuming that the source files are in the out_dir as well. --- src/command_helpers.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/command_helpers.rs b/src/command_helpers.rs index 9f83e38c0..88776e685 100644 --- a/src/command_helpers.rs +++ b/src/command_helpers.rs @@ -311,6 +311,14 @@ pub(crate) fn objects_from_files(files: &[Arc], dst: &Path) -> Result Date: Thu, 7 Nov 2024 13:02:57 +0100 Subject: [PATCH 2/5] Strip CARGO_MANIFEST_DIR instead of parent --- src/command_helpers.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/command_helpers.rs b/src/command_helpers.rs index 88776e685..0180613de 100644 --- a/src/command_helpers.rs +++ b/src/command_helpers.rs @@ -312,14 +312,14 @@ pub(crate) fn objects_from_files(files: &[Arc], dst: &Path) -> Result Date: Thu, 7 Nov 2024 14:33:34 +0100 Subject: [PATCH 3/5] Allow std::env::var --- src/command_helpers.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/command_helpers.rs b/src/command_helpers.rs index 0180613de..b65c6376c 100644 --- a/src/command_helpers.rs +++ b/src/command_helpers.rs @@ -315,6 +315,10 @@ pub(crate) fn objects_from_files(files: &[Arc], dst: &Path) -> Result Date: Thu, 7 Nov 2024 14:52:09 +0100 Subject: [PATCH 4/5] Implement review feedback --- src/command_helpers.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/command_helpers.rs b/src/command_helpers.rs index b65c6376c..5262e7405 100644 --- a/src/command_helpers.rs +++ b/src/command_helpers.rs @@ -314,14 +314,16 @@ pub(crate) fn objects_from_files(files: &[Arc], dst: &Path) -> Result Date: Thu, 7 Nov 2024 16:15:51 +0100 Subject: [PATCH 5/5] Import std::borrow::Cow --- src/command_helpers.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/command_helpers.rs b/src/command_helpers.rs index 5262e7405..adedab294 100644 --- a/src/command_helpers.rs +++ b/src/command_helpers.rs @@ -1,6 +1,7 @@ //! Miscellaneous helpers for running commands use std::{ + borrow::Cow, collections::hash_map, ffi::OsString, fmt::Display, @@ -320,7 +321,7 @@ pub(crate) fn objects_from_files(files: &[Arc], dst: &Path) -> Result