From 269ab866f147c5eec4ab81e35ec0db11a2ea6ffb Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 8 Oct 2023 13:03:22 +0200 Subject: refactor(tvix/eval/tests): migrate to tempfile tempdir pulls in remove_dir_all 0.5.3 with https://rustsec.org/advisories/RUSTSEC-2023-0018.html, and we use tempfile everywhere else too, so let's just migrate to that. Change-Id: I735ade7b65e12fc26e3d43ca95fcfa07fcc64642 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9565 Reviewed-by: Connor Brewster Autosubmit: flokli Tested-by: BuildkiteCI --- tvix/Cargo.lock | 78 ++----------------- tvix/Cargo.nix | 176 +++--------------------------------------- tvix/eval/Cargo.toml | 2 +- tvix/eval/tests/nix_oracle.rs | 3 +- 4 files changed, 22 insertions(+), 237 deletions(-) diff --git a/tvix/Cargo.lock b/tvix/Cargo.lock index 47e91cc15739..547bfad8292f 100644 --- a/tvix/Cargo.lock +++ b/tvix/Cargo.lock @@ -764,12 +764,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "fuse-backend-rs" version = "0.10.5" @@ -1086,7 +1080,7 @@ dependencies = [ "bitmaps", "imbl-sized-chunks", "proptest", - "rand_core 0.6.4", + "rand_core", "rand_xoshiro", "serde", "version_check", @@ -1711,7 +1705,7 @@ dependencies = [ "lazy_static", "num-traits", "quick-error 2.0.1", - "rand 0.8.5", + "rand", "rand_chacha", "rand_xorshift", "regex-syntax 0.6.29", @@ -1814,19 +1808,6 @@ dependencies = [ "nibble_vec", ] -[[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.5" @@ -1835,7 +1816,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -1845,24 +1826,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.4", + "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.4" @@ -1878,7 +1844,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" dependencies = [ - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -1887,7 +1853,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" dependencies = [ - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -1912,15 +1878,6 @@ dependencies = [ "num_cpus", ] -[[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.2.16" @@ -1979,15 +1936,6 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "rnix" version = "0.11.0" @@ -2323,16 +2271,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "tempdir" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -dependencies = [ - "rand 0.4.6", - "remove_dir_all", -] - [[package]] name = "tempfile" version = "3.5.0" @@ -2645,7 +2583,7 @@ dependencies = [ "indexmap", "pin-project", "pin-project-lite", - "rand 0.8.5", + "rand", "slab", "tokio", "tokio-util", @@ -2815,7 +2753,7 @@ dependencies = [ "serde_json", "smol_str", "tabwriter", - "tempdir", + "tempfile", "test-generator", "test-strategy", "toml", diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix index f1c28ae81c4c..7c98171a351a 100644 --- a/tvix/Cargo.nix +++ b/tvix/Cargo.nix @@ -2173,16 +2173,6 @@ rec { } ]; - }; - "fuchsia-cprng" = rec { - crateName = "fuchsia-cprng"; - version = "0.1.1"; - edition = "2018"; - sha256 = "1fnkqrbz7ixxzsb04bsz9p0zzazanma8znfdqjvh39n14vapfvx0"; - authors = [ - "Erick Tryzelaar " - ]; - }; "fuse-backend-rs" = rec { crateName = "fuse-backend-rs"; @@ -3164,7 +3154,7 @@ rec { } { name = "rand_core"; - packageId = "rand_core 0.6.4"; + packageId = "rand_core"; } { name = "rand_xoshiro"; @@ -4943,7 +4933,7 @@ rec { } { name = "rand"; - packageId = "rand 0.8.5"; + packageId = "rand"; usesDefaultFeatures = false; features = [ "alloc" ]; } @@ -5261,53 +5251,7 @@ rec { "serde" = [ "dep:serde" ]; }; }; - "rand 0.4.6" = rec { - crateName = "rand"; - version = "0.4.6"; - edition = "2015"; - sha256 = "14qjfv3gggzhnma20k0sc1jf8y6pplsaq7n1j9ls5c8kf2wl0a2m"; - authors = [ - "The Rust Project Developers" - ]; - dependencies = [ - { - name = "fuchsia-cprng"; - packageId = "fuchsia-cprng"; - target = { target, features }: ("fuchsia" == target."os"); - } - { - name = "libc"; - packageId = "libc"; - optional = true; - target = { target, features }: (target."unix" or false); - } - { - name = "rand_core"; - packageId = "rand_core 0.3.1"; - usesDefaultFeatures = false; - target = { target, features }: ("sgx" == target."env"); - } - { - name = "rdrand"; - packageId = "rdrand"; - target = { target, features }: ("sgx" == target."env"); - } - { - name = "winapi"; - packageId = "winapi"; - target = { target, features }: (target."windows" or false); - features = [ "minwindef" "ntsecapi" "profileapi" "winnt" ]; - } - ]; - features = { - "default" = [ "std" ]; - "libc" = [ "dep:libc" ]; - "nightly" = [ "i128_support" ]; - "std" = [ "libc" ]; - }; - resolvedDefaultFeatures = [ "default" "libc" "std" ]; - }; - "rand 0.8.5" = rec { + "rand" = rec { crateName = "rand"; version = "0.8.5"; edition = "2018"; @@ -5332,7 +5276,7 @@ rec { } { name = "rand_core"; - packageId = "rand_core 0.6.4"; + packageId = "rand_core"; } ]; features = { @@ -5370,7 +5314,7 @@ rec { } { name = "rand_core"; - packageId = "rand_core 0.6.4"; + packageId = "rand_core"; } ]; features = { @@ -5381,45 +5325,7 @@ rec { }; resolvedDefaultFeatures = [ "std" ]; }; - "rand_core 0.3.1" = rec { - crateName = "rand_core"; - version = "0.3.1"; - edition = "2015"; - sha256 = "0jzdgszfa4bliigiy4hi66k7fs3gfwi2qxn8vik84ph77fwdwvvs"; - authors = [ - "The Rand Project Developers" - "The Rust Project Developers" - ]; - dependencies = [ - { - name = "rand_core"; - packageId = "rand_core 0.4.2"; - } - ]; - features = { - "alloc" = [ "rand_core/alloc" ]; - "default" = [ "std" ]; - "serde1" = [ "rand_core/serde1" ]; - "std" = [ "rand_core/std" ]; - }; - }; - "rand_core 0.4.2" = rec { - crateName = "rand_core"; - version = "0.4.2"; - edition = "2015"; - sha256 = "1p09ynysrq1vcdlmcqnapq4qakl2yd1ng3kxh3qscpx09k2a6cww"; - authors = [ - "The Rand Project Developers" - "The Rust Project Developers" - ]; - features = { - "serde" = [ "dep:serde" ]; - "serde1" = [ "serde" "serde_derive" ]; - "serde_derive" = [ "dep:serde_derive" ]; - "std" = [ "alloc" ]; - }; - }; - "rand_core 0.6.4" = rec { + "rand_core" = rec { crateName = "rand_core"; version = "0.6.4"; edition = "2018"; @@ -5455,7 +5361,7 @@ rec { dependencies = [ { name = "rand_core"; - packageId = "rand_core 0.6.4"; + packageId = "rand_core"; } ]; features = { @@ -5474,7 +5380,7 @@ rec { dependencies = [ { name = "rand_core"; - packageId = "rand_core 0.6.4"; + packageId = "rand_core"; } ]; features = { @@ -5533,26 +5439,6 @@ rec { ]; }; - "rdrand" = rec { - crateName = "rdrand"; - version = "0.4.0"; - edition = "2015"; - sha256 = "1cjq0kwx1bk7jx3kzyciiish5gqsj7620dm43dc52sr8fzmm9037"; - authors = [ - "Simonas Kazlauskas " - ]; - dependencies = [ - { - name = "rand_core"; - packageId = "rand_core 0.3.1"; - usesDefaultFeatures = false; - } - ]; - features = { - "default" = [ "std" ]; - }; - resolvedDefaultFeatures = [ "default" "std" ]; - }; "redox_syscall 0.2.16" = rec { crateName = "redox_syscall"; version = "0.2.16"; @@ -5733,24 +5619,6 @@ rec { }; resolvedDefaultFeatures = [ "default" "std" "unicode" "unicode-age" "unicode-bool" "unicode-case" "unicode-gencat" "unicode-perl" "unicode-script" "unicode-segment" ]; }; - "remove_dir_all" = rec { - crateName = "remove_dir_all"; - version = "0.5.3"; - edition = "2015"; - sha256 = "1rzqbsgkmr053bxxl04vmvsd1njyz0nxvly97aip6aa2cmb15k9s"; - authors = [ - "Aaronepower " - ]; - dependencies = [ - { - name = "winapi"; - packageId = "winapi"; - target = { target, features }: (target."windows" or false); - features = [ "std" "errhandlingapi" "winerror" "fileapi" "winbase" ]; - } - ]; - - }; "rnix" = rec { crateName = "rnix"; version = "0.11.0"; @@ -6752,26 +6620,6 @@ rec { }; resolvedDefaultFeatures = [ "default" ]; }; - "tempdir" = rec { - crateName = "tempdir"; - version = "0.3.7"; - edition = "2015"; - sha256 = "1n5n86zxpgd85y0mswrp5cfdisizq2rv3la906g6ipyc03xvbwhm"; - authors = [ - "The Rust Project Developers" - ]; - dependencies = [ - { - name = "rand"; - packageId = "rand 0.4.6"; - } - { - name = "remove_dir_all"; - packageId = "remove_dir_all"; - } - ]; - - }; "tempfile" = rec { crateName = "tempfile"; version = "3.5.0"; @@ -7793,7 +7641,7 @@ rec { } { name = "rand"; - packageId = "rand 0.8.5"; + packageId = "rand"; optional = true; features = [ "small_rng" ]; } @@ -8476,8 +8324,8 @@ rec { packageId = "pretty_assertions"; } { - name = "tempdir"; - packageId = "tempdir"; + name = "tempfile"; + packageId = "tempfile"; } { name = "test-generator"; @@ -9869,7 +9717,7 @@ rec { features = { "debug" = [ "impl-debug" ]; }; - resolvedDefaultFeatures = [ "basetsd" "consoleapi" "errhandlingapi" "fileapi" "handleapi" "knownfolders" "minwinbase" "minwindef" "ntsecapi" "ntstatus" "objbase" "processenv" "processthreadsapi" "profileapi" "shellapi" "shlobj" "std" "stringapiset" "synchapi" "sysinfoapi" "winbase" "wincon" "winerror" "winnt" "winuser" "ws2ipdef" "ws2tcpip" ]; + resolvedDefaultFeatures = [ "basetsd" "consoleapi" "errhandlingapi" "fileapi" "handleapi" "knownfolders" "minwinbase" "minwindef" "ntstatus" "objbase" "processenv" "processthreadsapi" "shellapi" "shlobj" "std" "stringapiset" "synchapi" "sysinfoapi" "winbase" "wincon" "winerror" "winnt" "winuser" "ws2ipdef" "ws2tcpip" ]; }; "winapi-i686-pc-windows-gnu" = rec { crateName = "winapi-i686-pc-windows-gnu"; diff --git a/tvix/eval/Cargo.toml b/tvix/eval/Cargo.toml index cd5af7709c71..2098d470619a 100644 --- a/tvix/eval/Cargo.toml +++ b/tvix/eval/Cargo.toml @@ -35,7 +35,7 @@ xml-rs = "0.8.4" criterion = "0.4" pretty_assertions = "1.2.1" itertools = "0.10.3" -tempdir = "0.3.7" +tempfile = "3.3.0" [dev-dependencies.test-generator] # This fork of test-generator adds support for cargo workspaces, see diff --git a/tvix/eval/tests/nix_oracle.rs b/tvix/eval/tests/nix_oracle.rs index e8bd004f1d14..b777d289e03b 100644 --- a/tvix/eval/tests/nix_oracle.rs +++ b/tvix/eval/tests/nix_oracle.rs @@ -3,7 +3,6 @@ use std::{env, path::PathBuf, process::Command}; use pretty_assertions::assert_eq; -use tempdir::TempDir; fn nix_binary_path() -> PathBuf { env::var("NIX_INSTANTIATE_BINARY_PATH") @@ -18,7 +17,7 @@ enum Strictness { } fn nix_eval(expr: &str, strictness: Strictness) -> String { - let store_dir = TempDir::new("store-dir").unwrap(); + let store_dir = tempfile::tempdir().unwrap(); let mut args = match strictness { Strictness::Lazy => vec![], -- cgit 1.4.1