fix: replace chrono and update rustix for RustSec
Rust CI tiny-wb failed CI.
Gitea/tiny-wb/pipeline/head There was a failure building this commit Details

This commit is contained in:
Dandaedre 2026-11-20 18:22:58 +01:00
parent 82a495092d
commit bc552348d6
9 changed files with 116 additions and 144 deletions

194
Cargo.lock generated
View File

@ -32,15 +32,6 @@ version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
[[package]]
name = "android_system_properties"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.104" version = "1.0.104"
@ -155,16 +146,6 @@ dependencies = [
"rustversion", "rustversion",
] ]
[[package]]
name = "cc"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f74872d07caf508b30a21f6836e7d7016a2eaf7d9ff4f48deaa58cd8a0407630"
dependencies = [
"find-msvc-tools",
"shlex",
]
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.5" version = "1.0.5"
@ -177,19 +158,6 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"
[[package]]
name = "chrono"
version = "0.4.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
dependencies = [
"iana-time-zone",
"js-sys",
"num-traits",
"wasm-bindgen",
"windows-link",
]
[[package]] [[package]]
name = "color-eyre" name = "color-eyre"
version = "0.6.5" version = "0.6.5"
@ -468,12 +436,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "find-msvc-tools"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"
[[package]] [[package]]
name = "finl_unicode" name = "finl_unicode"
version = "1.5.0" version = "1.5.0"
@ -488,11 +450,11 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]] [[package]]
name = "flexi_logger" name = "flexi_logger"
version = "0.29.8" version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88a5a6882b2e137c4f2664562995865084eb5a00611fba30c582ef10354c4ad8" checksum = "5e87b74024da93123949cca26cb6e366744234fdd4d7914eb3dfeab0baa82d51"
dependencies = [ dependencies = [
"chrono", "jiff",
"log", "log",
"nu-ansi-term", "nu-ansi-term",
"regex", "regex",
@ -608,30 +570,6 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "iana-time-zone"
version = "0.1.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"log",
"wasm-bindgen",
"windows-core",
]
[[package]]
name = "iana-time-zone-haiku"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "ident_case" name = "ident_case"
version = "1.0.1" version = "1.0.1"
@ -701,6 +639,58 @@ version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "jiff"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e"
dependencies = [
"jiff-core",
"jiff-static",
"jiff-tzdb-platform",
"log",
"portable-atomic",
"portable-atomic-util",
"serde_core",
"windows-link",
]
[[package]]
name = "jiff-core"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8"
dependencies = [
"log",
]
[[package]]
name = "jiff-static"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0127e9bde3c6130d6169e7d8d68676e4be69c4bf7573c308b6f960a5089c428"
dependencies = [
"jiff-core",
"proc-macro2",
"quote",
"syn 3.0.6",
]
[[package]]
name = "jiff-tzdb"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc"
[[package]]
name = "jiff-tzdb-platform"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e"
dependencies = [
"jiff-tzdb",
]
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.106" version = "0.3.106"
@ -1167,6 +1157,15 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
[[package]]
name = "portable-atomic-util"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715"
dependencies = [
"portable-atomic",
]
[[package]] [[package]]
name = "powerfmt" name = "powerfmt"
version = "0.2.0" version = "0.2.0"
@ -1374,9 +1373,9 @@ dependencies = [
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "1.1.5" version = "1.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa"
dependencies = [ dependencies = [
"bitflags 2.13.2", "bitflags 2.13.2",
"errno", "errno",
@ -1487,12 +1486,6 @@ dependencies = [
"lazy_static", "lazy_static",
] ]
[[package]]
name = "shlex"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]] [[package]]
name = "signal-hook" name = "signal-hook"
version = "0.3.18" version = "0.3.18"
@ -1758,9 +1751,9 @@ checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"
name = "tiny-wb" name = "tiny-wb"
version = "0.1.5" version = "0.1.5"
dependencies = [ dependencies = [
"chrono",
"color-eyre", "color-eyre",
"flexi_logger", "flexi_logger",
"jiff",
"log", "log",
"ratatui", "ratatui",
"serde", "serde",
@ -2121,65 +2114,12 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-core"
version = "0.62.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
dependencies = [
"windows-implement",
"windows-interface",
"windows-link",
"windows-result",
"windows-strings",
]
[[package]]
name = "windows-implement"
version = "0.60.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
]
[[package]]
name = "windows-interface"
version = "0.59.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
]
[[package]] [[package]]
name = "windows-link" name = "windows-link"
version = "0.2.1" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
[[package]]
name = "windows-result"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
dependencies = [
"windows-link",
]
[[package]]
name = "windows-strings"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
dependencies = [
"windows-link",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.52.0" version = "0.52.0"

View File

@ -2,7 +2,7 @@
name = "tiny-wb" name = "tiny-wb"
version = "0.1.5" version = "0.1.5"
edition = "2021" edition = "2021"
rust-version = "1.88.0" rust-version = "1.91.0"
license = "MIT" license = "MIT"
repository = "https://proxy.dandaedre.com/gitea/idle-org/tiny-wb" repository = "https://proxy.dandaedre.com/gitea/idle-org/tiny-wb"
@ -49,9 +49,9 @@ path = "tests/mock_device.rs"
required-features = ["mock"] required-features = ["mock"]
[dependencies] [dependencies]
chrono = "0.4.38"
color-eyre = { version = "0.6.3", optional = true } color-eyre = { version = "0.6.3", optional = true }
flexi_logger = { version = "0.29.0", optional = true } flexi_logger = { version = "0.32.0", optional = true }
jiff = "1.0.1"
log = "0.4.22" log = "0.4.22"
ratatui = { version = "=0.30.2", optional = true } ratatui = { version = "=0.30.2", optional = true }
serde = { version = "1.0.210", features = ["derive"] } serde = { version = "1.0.210", features = ["derive"] }

2
Jenkinsfile vendored
View File

@ -16,7 +16,7 @@ pipeline {
RUST_BACKTRACE = '1' RUST_BACKTRACE = '1'
// LTS-like compatibility floor verified by the dedicated MSRV stage. // LTS-like compatibility floor verified by the dedicated MSRV stage.
MSRV = '1.88.0' MSRV = '1.91.0'
// Supply-chain tools are pinned for reproducible policy behavior. // Supply-chain tools are pinned for reproducible policy behavior.
CARGO_AUDIT_VERSION = '0.22.2' CARGO_AUDIT_VERSION = '0.22.2'

View File

@ -25,7 +25,7 @@ cable**, and access to its serial port. Close other software using the tinySA.
For a first communications check, leave external RF sources disconnected. For a first communications check, leave external RF sources disconnected.
Before connecting a signal, read the [safe-operation guide](docs/tinysa-field-guide.md#safe-operation-read-before-connecting-a-signal). Before connecting a signal, read the [safe-operation guide](docs/tinysa-field-guide.md#safe-operation-read-before-connecting-a-signal).
To build from source, install Rust **1.88 or newer**, then run: To build from source, install Rust **1.91 or newer**, then run:
```console ```console
git clone https://proxy.dandaedre.com/gitea/idle-org/tiny-wb.git git clone https://proxy.dandaedre.com/gitea/idle-org/tiny-wb.git

View File

@ -167,7 +167,7 @@ See [configuration](configuration.md) for settings, paths and exact behavior.
The core uses standard-library byte decoding instead of `packed_struct`, and The core uses standard-library byte decoding instead of `packed_struct`, and
buffered framing instead of a separate direct `memchr` dependency. Transitive buffered framing instead of a separate direct `memchr` dependency. Transitive
`memchr` use elsewhere in the graph is unrelated. Serde/TOML handle settings; `memchr` use elsewhere in the graph is unrelated. Serde/TOML handle settings;
serialport, Ratatui, chrono, log/flexi_logger, color-eyre and thiserror retain serialport, Ratatui, jiff, log/flexi_logger, color-eyre and thiserror retain
their device, presentation, timestamp and error-reporting roles. their device, presentation, timestamp and error-reporting roles.
Library consumers can omit terminal and serial dependencies; see [feature selection](library.md). Library consumers can omit terminal and serial dependencies; see [feature selection](library.md).

View File

@ -1,7 +1,7 @@
# Rust library integration # Rust library integration
The package builds both `tiny_wb` (Rust library) and `tiny-wb` (terminal app). The package builds both `tiny_wb` (Rust library) and `tiny-wb` (terminal app).
Rust 1.88 or newer is required. To integrate a checkout without terminal, serial, Rust 1.91 or newer is required. To integrate a checkout without terminal, serial,
libudev or Windows resource dependencies: libudev or Windows resource dependencies:
```toml ```toml

View File

@ -7,7 +7,7 @@ runs `cargo-audit` plus `cargo-deny`. No other hardening tools are in scope.
## Rust compatibility floor ## Rust compatibility floor
The declared and CI-tested minimum supported Rust version (MSRV) is The declared and CI-tested minimum supported Rust version (MSRV) is
**Rust 1.88.0**. This is an LTS-like project policy rather than an upstream Rust **Rust 1.91.0**. This is an LTS-like project policy rather than an upstream Rust
LTS designation: Rust itself does not publish LTS toolchains. LTS designation: Rust itself does not publish LTS toolchains.
The application code and the former Ratatui 0.28 dependency could be made to The application code and the former Ratatui 0.28 dependency could be made to
@ -15,14 +15,23 @@ compile with older compilers, but that graph contained the unmaintained `paste`
crate and `lru` releases covered by RustSec soundness advisories. Ratatui 0.30.0 crate and `lru` releases covered by RustSec soundness advisories. Ratatui 0.30.0
still locked an affected optional `lru` and a vulnerable `time`. Ratatui 0.30.2 still locked an affected optional `lru` and a vulnerable `time`. Ratatui 0.30.2
is the first tested upstream line that clears those findings, and it declares is the first tested upstream line that clears those findings, and it declares
Rust 1.88.0. The project therefore treats 1.88.0 as the lowest supported clean Rust 1.88.0. That established the previous compatibility floor.
graph rather than adding advisory exceptions or local dependency patches.
`Cargo.toml` declares `rust-version = "1.88.0"`. CI installs that exact On 2026-11-20, [RUSTSEC-2026-0543](https://rustsec.org/advisories/RUSTSEC-2026-0543)
required removing chrono (all versions are unmaintained). CSV export and the
hardware-validation example now use jiff, preserving local-time filenames and
six fractional digits. flexi_logger 0.32 removes its transitive chrono dependency
and requires Rust 1.91.0, which is the new build and CI floor. Existing logging
settings remain compatible; source builders must upgrade their Rust toolchain.
The locked rustix is also updated to at least 1.1.6 for
[RUSTSEC-2026-0486](https://rustsec.org/advisories/RUSTSEC-2026-0486).
Neither advisory is ignored.
`Cargo.toml` declares `rust-version = "1.91.0"`. CI installs that exact
toolchain and runs: toolchain and runs:
```console ```console
cargo +1.88.0 check --locked --all-targets --all-features cargo +1.91.0 check --locked --all-targets --all-features
``` ```
The normal CI jobs use current stable Rust, while the MSRV job prevents source The normal CI jobs use current stable Rust, while the MSRV job prevents source
@ -118,7 +127,7 @@ Run from the repository root, in this order:
cargo audit --deny warnings cargo audit --deny warnings
cargo deny check cargo deny check
cargo fmt --all -- --check cargo fmt --all -- --check
cargo +1.88.0 check --locked --all-targets --all-features cargo +1.91.0 check --locked --all-targets --all-features
cargo check --locked --all-targets --all-features cargo check --locked --all-targets --all-features
cargo test --locked --all-targets --all-features cargo test --locked --all-targets --all-features
cargo test --locked --no-default-features --lib cargo test --locked --no-default-features --lib
@ -202,7 +211,7 @@ unchanged. This corrects report scope, not test coverage. The subsequent supplie
FreeBSD Jenkins build #7 confirmed `Final line coverage: 90.87%` and passed the FreeBSD Jenkins build #7 confirmed `Final line coverage: 90.87%` and passed the
coverage stage. That build then stopped at Clippy's `chunks_exact_to_as_chunks` coverage stage. That build then stopped at Clippy's `chunks_exact_to_as_chunks`
lint; the decoder now iterates fixed-size records with `as_chunks::<3>()`, lint; the decoder now iterates fixed-size records with `as_chunks::<3>()`,
compatible with the declared Rust 1.88 MSRV. Its exact frame-length validation compatible with the then-declared Rust 1.88 MSRV. Its exact frame-length validation
still rejects incomplete records before iteration. still rejects incomplete records before iteration.
At checkout, CI recreates ignored `coverage/` to remove stale workspace state. At checkout, CI recreates ignored `coverage/` to remove stale workspace state.

View File

@ -226,7 +226,7 @@ fn run() -> Result<(), Box<dyn Error>> {
let session = arguments.output.join(format!( let session = arguments.output.join(format!(
"{}-{}", "{}-{}",
arguments.model.name().to_ascii_lowercase(), arguments.model.name().to_ascii_lowercase(),
chrono::Local::now().format("%Y%m%d-%H%M%S-%6f") jiff::ZonedDateTime::now().strftime("%Y%m%d-%H%M%S-%6f")
)); ));
fs::create_dir_all(&session)?; fs::create_dir_all(&session)?;

View File

@ -1,7 +1,7 @@
//! CSV serialization and collision-safe file creation, separate from decoding. //! CSV serialization and collision-safe file creation, separate from decoding.
use crate::{config::OutputConfig, protocol::Sample}; use crate::{config::OutputConfig, protocol::Sample};
use chrono::Local; use jiff::ZonedDateTime;
use std::{ use std::{
fs::{self, OpenOptions}, fs::{self, OpenOptions},
io::{self, BufRead, BufWriter, Write}, io::{self, BufRead, BufWriter, Write},
@ -108,7 +108,7 @@ pub fn write_csv(
/// Readers may see the in-progress file, so only the returned path means complete. /// Readers may see the in-progress file, so only the returned path means complete.
pub fn save_csv(samples: &[Sample], settings: &OutputConfig) -> io::Result<PathBuf> { pub fn save_csv(samples: &[Sample], settings: &OutputConfig) -> io::Result<PathBuf> {
fs::create_dir_all(&settings.directory)?; fs::create_dir_all(&settings.directory)?;
let stamp = Local::now().format("%Y%m%d %H_%M_%S_%6f").to_string(); let stamp = filename_stamp(&ZonedDateTime::now());
for suffix in 0..100 { for suffix in 0..100 {
let path = settings let path = settings
.directory .directory
@ -135,10 +135,33 @@ pub fn save_csv(samples: &[Sample], settings: &OutputConfig) -> io::Result<PathB
)) ))
} }
/// Preserve the local calendar fields and six fractional digits in export names.
fn filename_stamp(now: &ZonedDateTime) -> String {
now.strftime("%Y%m%d %H_%M_%S_%6f").to_string()
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
#[test]
fn filename_timestamp_preserves_local_time_and_microseconds() {
for (input, expected) in [
(
"2024-02-29T23:59:58.123456789+05:30[+05:30]",
"20240229 23_59_58_123456",
),
(
"2026-01-01T00:00:00.000001-04:00[-04:00]",
"20260101 00_00_00_000001",
),
("2026-01-01T00:00:00Z[UTC]", "20260101 00_00_00_000000"),
] {
let now: ZonedDateTime = input.parse().unwrap();
assert_eq!(filename_stamp(&now), expected);
}
}
#[test] #[test]
fn csv_has_explicit_units_only_when_requested() { fn csv_has_explicit_units_only_when_requested() {
let samples = [Sample { let samples = [Sample {