diff --git a/server/Cargo.lock b/server/Cargo.lock index b7abea7..b180d89 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -653,12 +653,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3958af68a31b1d1384d3f39b6aa33eb14b6009065b5ca305ddd9712a4237124f" -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "funty" version = "1.1.0" @@ -1224,7 +1218,7 @@ dependencies = [ "ring", "rusqlite", "smallvec", - "tempdir", + "tempfile", "time", "uuid", ] @@ -1282,7 +1276,7 @@ dependencies = [ "smallvec", "structopt", "sync_wrapper", - "tempdir", + "tempfile", "time", "tokio", "tokio-stream", @@ -1521,7 +1515,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1a5d4e9c205d2c1ae73b84aab6240e98218c0e72e63b50422cfb2d1ca952282" dependencies = [ "base64ct", - "rand_core 0.6.2", + "rand_core", "subtle", ] @@ -1696,19 +1690,6 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", -] - [[package]] name = "rand" version = "0.8.3" @@ -1717,7 +1698,7 @@ checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ "libc", "rand_chacha", - "rand_core 0.6.2", + "rand_core", "rand_hc", ] @@ -1728,24 +1709,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" dependencies = [ "ppv-lite86", - "rand_core 0.6.2", + "rand_core", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.6.2" @@ -1761,7 +1727,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" dependencies = [ - "rand_core 0.6.2", + "rand_core", ] [[package]] @@ -1779,15 +1745,6 @@ dependencies = [ "rawpointer", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.1.57" @@ -2227,13 +2184,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] -name = "tempdir" -version = "0.3.7" +name = "tempfile" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "rand 0.4.6", + "cfg-if 1.0.0", + "libc", + "rand", + "redox_syscall 0.2.8", "remove_dir_all", + "winapi", ] [[package]] @@ -2435,7 +2396,7 @@ dependencies = [ "httparse", "input_buffer", "log", - "rand 0.8.3", + "rand", "sha-1", "thiserror", "url", diff --git a/server/Cargo.toml b/server/Cargo.toml index 0cc4aa9..0784b1a 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -65,7 +65,7 @@ uuid = { version = "0.8", features = ["serde", "std", "v4"] } [dev-dependencies] reqwest = { version = "0.11.0", default-features = false, features = ["json"] } -tempdir = "0.3" +tempfile = "3.2.0" [profile.dev.package.scrypt] # On an Intel i3-6100U @ 2.30 GHz, a single scrypt password hash takes 7.6 diff --git a/server/db/Cargo.toml b/server/db/Cargo.toml index bdd53a7..64b39fe 100644 --- a/server/db/Cargo.toml +++ b/server/db/Cargo.toml @@ -36,7 +36,7 @@ protobuf = { git = "https://github.com/stepancheg/rust-protobuf" } ring = "0.16.2" rusqlite = "0.25.3" smallvec = "1.0" -tempdir = "0.3" +tempfile = "3.2.0" time = "0.1" uuid = { version = "0.8", features = ["std", "v4"] } itertools = "0.10.0" diff --git a/server/db/db.rs b/server/db/db.rs index 855bee7..ea8406a 100644 --- a/server/db/db.rs +++ b/server/db/db.rs @@ -2506,7 +2506,10 @@ mod tests { testutil::init(); let conn = setup_conn(); let db = Database::new(clock::RealClocks {}, conn, true).unwrap(); - let tmpdir = tempdir::TempDir::new("moonfire-nvr-test").unwrap(); + let tmpdir = tempfile::Builder::new() + .prefix("moonfire-nvr-test") + .tempdir() + .unwrap(); let path = tmpdir.path().to_str().unwrap().to_owned(); let sample_file_dir_id = { db.lock() }.add_sample_file_dir(path).unwrap(); let mut c = CameraChange { diff --git a/server/db/testutil.rs b/server/db/testutil.rs index 160bb83..77d05fe 100644 --- a/server/db/testutil.rs +++ b/server/db/testutil.rs @@ -15,7 +15,7 @@ use rusqlite; use std::env; use std::sync::Arc; use std::thread; -use tempdir::TempDir; +use tempfile::TempDir; use time; use uuid::Uuid; @@ -67,7 +67,10 @@ impl TestDb { } pub(crate) fn new_with_flush_if_sec(clocks: C, flush_if_sec: i64) -> Self { - let tmpdir = TempDir::new("moonfire-nvr-test").unwrap(); + let tmpdir = tempfile::Builder::new() + .prefix("moonfire-nvr-test") + .tempdir() + .unwrap(); let mut conn = rusqlite::Connection::open_in_memory().unwrap(); db::init(&mut conn).unwrap(); diff --git a/server/db/upgrade/mod.rs b/server/db/upgrade/mod.rs index 273160f..6dc0f23 100644 --- a/server/db/upgrade/mod.rs +++ b/server/db/upgrade/mod.rs @@ -199,7 +199,9 @@ mod tests { #[test] fn upgrade_and_compare() -> Result<(), Error> { testutil::init(); - let tmpdir = tempdir::TempDir::new("moonfire-nvr-test")?; + let tmpdir = tempfile::Builder::new() + .prefix("moonfire-nvr-test") + .tempdir()?; //let path = tmpdir.path().to_str().ok_or_else(|| format_err!("invalid UTF-8"))?.to_owned(); let mut upgraded = new_conn()?; upgraded.execute_batch(include_str!("v0.sql"))?; diff --git a/server/db/writer.rs b/server/db/writer.rs index 030a872..dc48ba3 100644 --- a/server/db/writer.rs +++ b/server/db/writer.rs @@ -1045,7 +1045,7 @@ mod tests { struct Harness { db: Arc>, dir_id: i32, - _tmpdir: ::tempdir::TempDir, + _tmpdir: ::tempfile::TempDir, dir: MockDir, channel: super::SyncerChannel, syncer: super::Syncer,