You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The download_executables starts by checking if all the files exists, if so, it returns:
fn download_executables(config: &Config) {
let download_dir = Path::new(env!("HOME")).join(&config.download_dir);
if !download_dir.exists() {
std::fs::create_dir_all(&download_dir).expect("Failed to create download directory");
}
if config
.file_names
.iter()
.all(|filename| download_dir.join(filename).exists())
{
return;
}
...
}
This is an issue, because the files might exist, but not be "valid" due to two issues:
If validate_unpacked_files(&download_dir, &config.file_names, &sha256_sums); fails. In which case the files are still left in the correct location. Running the download_executables again makes return and hence the files which (may) have failed the fingerprint validation are used.
If set_execute_permissions fails. In which case the files are left unexecutable.
The current approach also has issues when the tool is updated: the files for the old prover might still be on disk, preventing an update.
It might be useful to explore a "content addressable" approach: where the file names are the SHA256 hashes, i.e. stone-prover-d8cb6bab6576674d7d8ee986fe0da2598ee8c546517c997980eae6725d0ad017 which enables several different version of the binaries to exists on disk without interfering with each other. Checking for the existence of the files corresponds to checking for a specific version of all the binaries. You can then point at the specific version used by setting the environment variables.
When checking for them, make sure that they are also set executable.
Probably also a good idea to write the files to a temporary directory first, then validate the fingerprints and only then write them to the destination. That way we also avoid leaving artifacts on disk if we fail.
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: