mirror of
https://github.com/hanzoai/vm.git
synced 2026-10-01 00:47:56 +00:00
measure: compile off unix
The file identity the digest cache keys on was unix-only, so vm-measure did not compile for Windows. The hanzo CLI links it on all five targets it ships, and every Windows build of the CLI since it took the crate (v8.5.158, v8.5.160) failed there: `cannot find function identity`. Off unix the identity is length and modification time; the Linux CI leg now checks the crate for Windows. 2.0.3. Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -31,4 +31,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-pc-windows-gnu
|
||||
- run: cargo check -p vm-linux
|
||||
# The hanzo CLI links vm-measure on all five targets it ships. 2.0.1 and
|
||||
# 2.0.2 compiled on unix only, and every Windows build of the CLI since
|
||||
# failed on them, so this leg compiles it for Windows too.
|
||||
- run: cargo check -p vm-measure --target x86_64-pc-windows-gnu
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 2.0.3
|
||||
|
||||
`vm-measure` compiles off unix. Its file identity was unix-only, so the `hanzo`
|
||||
CLI, which links it on every target it ships, failed to build for Windows from
|
||||
the day it took the crate. Off unix the identity is length and modification
|
||||
time.
|
||||
|
||||
## 2.0.2
|
||||
|
||||
Two things 2.0.1 got wrong, found within the hour of publishing it by running
|
||||
|
||||
Generated
+1
-1
@@ -2188,7 +2188,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vm-measure"
|
||||
version = "2.0.2"
|
||||
version = "2.0.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"libc",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "vm-measure"
|
||||
version = "2.0.2"
|
||||
version = "2.0.3"
|
||||
edition = "2021"
|
||||
description = "Measured boot for the Hanzo microVM: an extend-only register over what was loaded"
|
||||
license = "Apache-2.0"
|
||||
|
||||
@@ -437,6 +437,27 @@ fn identity(path: &Path) -> Result<Entry> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Stable std reports no device or inode off unix, so there the identity is
|
||||
/// length and modification time. The `hanzo` CLI links this crate on every
|
||||
/// target it ships, Windows included.
|
||||
#[cfg(not(unix))]
|
||||
fn identity(path: &Path) -> Result<Entry> {
|
||||
let meta = std::fs::metadata(path).with_context(|| format!("measuring {}", path.display()))?;
|
||||
let modified = meta
|
||||
.modified()
|
||||
.with_context(|| format!("measuring {}", path.display()))?
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap_or_default();
|
||||
Ok(Entry {
|
||||
device: 0,
|
||||
inode: 0,
|
||||
length: meta.len(),
|
||||
modified: modified.as_secs() as i64,
|
||||
modified_nanos: i64::from(modified.subsec_nanos()),
|
||||
digest: Digest::zero(),
|
||||
})
|
||||
}
|
||||
|
||||
// ---- hex ----------------------------------------------------------------------
|
||||
|
||||
fn hex(bytes: &[u8]) -> String {
|
||||
|
||||
Reference in New Issue
Block a user