From d10c88f0c972191b2a702857000f1f56038bf797 Mon Sep 17 00:00:00 2001 From: Tim Bruijnzeels Date: Fri, 15 May 2020 16:37:33 +0200 Subject: [PATCH] Release 0.6.2 - Fix issue with determining creation time on certain platforms. --- Cargo.lock | 2 +- Cargo.toml | 2 +- Changelog.md | 8 ++++++++ doc/openapi.yaml | 2 +- src/constants.rs | 2 +- src/pubd/repository.rs | 27 ++++++++++++++------------- 6 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e3b9a770b..5ffa1c4fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -661,7 +661,7 @@ dependencies = [ [[package]] name = "krill" -version = "0.6.1" +version = "0.6.2" dependencies = [ "base64 0.10.1", "bcder", diff --git a/Cargo.toml b/Cargo.toml index c668f7ea4..f0de1cead 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "krill" -version = "0.6.1" +version = "0.6.2" edition = "2018" authors = [ "The NLnet Labs RPKI team " ] description = "Resource Public Key Infrastructure (RPKI) daemon" diff --git a/Changelog.md b/Changelog.md index 29d09e74c..e07e4218d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,14 @@ Please see [here](https://github.com/NLnetLabs/krill/projects?query=is%3Aopen+sort%3Aname-asc) for planned releases. +## 0.6.2 Release 'That was even faster!' + +So, as it turns out.. the code used to determine the age of snapshot files used in the previous +release was not safe on all platforms. This release fixes this! + +Users who upgraded to 0.6.1 and see messages like: "Creation time is not available on this +platform currently" in their logs, please upgrade! + ## 0.6.1 Release 'That was fast!' This release fixes an issue where the Krill Repository Server deleted RRDP snapshot files as soon diff --git a/doc/openapi.yaml b/doc/openapi.yaml index 63b2bd25d..88cbe8fd9 100644 --- a/doc/openapi.yaml +++ b/doc/openapi.yaml @@ -1,7 +1,7 @@ openapi: "3.0.2" info: title: Krill RPKI Server API - version: 0.6.1 + version: 0.6.2 description: | # Introduction Welcome to the documentation for the Krill server API, a JSON based diff --git a/src/constants.rs b/src/constants.rs index 08e8cb9c0..86e4c4ce3 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,4 +1,4 @@ -pub const KRILL_VERSION: &str = "0.6.1"; +pub const KRILL_VERSION: &str = "0.6.2"; pub const KRILL_SERVER_APP: &str = "Krill"; pub const KRILL_CLIENT_APP: &str = "Krill Client"; diff --git a/src/pubd/repository.rs b/src/pubd/repository.rs index 42b073f2c..347cf2fe7 100644 --- a/src/pubd/repository.rs +++ b/src/pubd/repository.rs @@ -264,7 +264,7 @@ impl RrdpServer { } else { let path = entry.path(); if path.is_dir() { - fs::remove_dir_all(path)?; + let _best_effort_rm = fs::remove_dir_all(path); } } } @@ -286,9 +286,9 @@ impl RrdpServer { if let Some(last) = self.notification.last_delta() { if serial < last { if path.is_dir() { - fs::remove_dir_all(path)?; + let _best_effort_rm = fs::remove_dir_all(path); } else { - fs::remove_file(path)?; + let _best_effort_rm = fs::remove_file(path); } continue; @@ -301,14 +301,15 @@ impl RrdpServer { let snapshot_path = Self::new_snapshot_path(&self.rrdp_base_dir, &self.session, serial); if snapshot_path.exists() { - let meta = fs::metadata(&snapshot_path)?; - let created = meta.created()?; - - let now = SystemTime::now(); - if let Ok(duration) = now.duration_since(created) { - let minutes_old = duration.as_secs() / 60; - if minutes_old >= REPOSITORY_RRDP_SNAPSHOT_RETAIN_MINS { - fs::remove_file(snapshot_path)?; + if let Ok(meta) = fs::metadata(&snapshot_path) { + if let Ok(created) = meta.created() { + let now = SystemTime::now(); + if let Ok(duration) = now.duration_since(created) { + let minutes_old = duration.as_secs() / 60; + if minutes_old >= REPOSITORY_RRDP_SNAPSHOT_RETAIN_MINS { + let _best_effort_rm = fs::remove_file(snapshot_path); + } + } } } } @@ -316,9 +317,9 @@ impl RrdpServer { } else { // clean up dirs or files under the base dir which are not sessions if path.is_dir() { - fs::remove_dir_all(path)?; + let _best_effort_rm = fs::remove_dir_all(path); } else { - fs::remove_file(path)?; + let _best_effort_rm = fs::remove_file(path); } } }