From d1ff631df841cae2aac44120fb64be08471195d3 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 3 Jul 2023 18:51:42 +0200 Subject: [PATCH 1/3] Replace the atty dependency with the is-terminal one --- Cargo.lock | 58 +++++++++++++++++++++++++++++------------ meilisearch/Cargo.toml | 16 +++--------- meilisearch/src/main.rs | 9 +++---- 3 files changed, 48 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9a59e2ea8..bcfe40cd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617a8268e3537fe1d8c9ead925fca49ef6400927ee7bc26750e90ecee14ce4b8" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bytes", "futures-core", "futures-sink", @@ -47,7 +47,7 @@ dependencies = [ "actix-utils", "ahash 0.8.3", "base64 0.21.2", - "bitflags", + "bitflags 1.3.2", "brotli", "bytes", "bytestring", @@ -527,6 +527,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + [[package]] name = "block-buffer" version = "0.10.4" @@ -773,7 +779,7 @@ version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ - "bitflags", + "bitflags 1.3.2", "clap_lex 0.2.4", "indexmap", "textwrap", @@ -798,7 +804,7 @@ checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" dependencies = [ "anstream", "anstyle", - "bitflags", + "bitflags 1.3.2", "clap_lex 0.5.0", "strsim", ] @@ -1676,7 +1682,7 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "libgit2-sys", "log", @@ -2058,13 +2064,12 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" dependencies = [ "hermit-abi 0.3.1", - "io-lifetimes", - "rustix 0.37.19", + "rustix 0.38.2", "windows-sys 0.48.0", ] @@ -2161,9 +2166,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.144" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libgit2-sys" @@ -2432,6 +2437,12 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +[[package]] +name = "linux-raw-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" + [[package]] name = "lmdb-rkv-sys" version = "0.15.1" @@ -2545,7 +2556,6 @@ dependencies = [ "assert-json-diff", "async-stream", "async-trait", - "atty", "brotli", "bstr", "byte-unit", @@ -2567,6 +2577,7 @@ dependencies = [ "index-scheduler", "indexmap", "insta", + "is-terminal", "itertools", "jsonwebtoken", "lazy_static", @@ -3226,7 +3237,7 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1de8dacb0873f77e6aefc6d71e044761fcc68060290f5b1089fcdf84626bb69" dependencies = [ - "bitflags", + "bitflags 1.3.2", "byteorder", "hex", "lazy_static", @@ -3333,7 +3344,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -3342,7 +3353,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -3484,7 +3495,7 @@ version = "0.36.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14e4d67015953998ad0eb82887a0eb0129e18a7e2f3b7b0f6c422fddcd503d62" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -3498,7 +3509,7 @@ version = "0.37.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -3506,6 +3517,19 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustix" +version = "0.38.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabcb0461ebd01d6b79945797c27f8529082226cb630a9865a71870ff63532a4" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys 0.4.3", + "windows-sys 0.48.0", +] + [[package]] name = "rustls" version = "0.20.8" diff --git a/meilisearch/Cargo.toml b/meilisearch/Cargo.toml index 7d6601ac5..3fbc21d82 100644 --- a/meilisearch/Cargo.toml +++ b/meilisearch/Cargo.toml @@ -19,6 +19,7 @@ actix-http = { version = "3.3.1", default-features = false, features = [ "compress-gzip", "rustls", ] } +actix-utils = "3.0.1" actix-web = { version = "4.3.1", default-features = false, features = [ "macros", "compress-brotli", @@ -50,6 +51,7 @@ futures-util = "0.3.28" http = "0.2.9" index-scheduler = { path = "../index-scheduler" } indexmap = { version = "1.9.3", features = ["serde-1"] } +is-terminal = "0.4.8" itertools = "0.10.5" jsonwebtoken = "8.3.0" lazy_static = "1.4.0" @@ -100,8 +102,6 @@ uuid = { version = "1.3.1", features = ["serde", "v4"] } walkdir = "2.3.3" yaup = "0.2.1" serde_urlencoded = "0.7.1" -actix-utils = "3.0.1" -atty = "0.2.14" termcolor = "1.2.0" [dev-dependencies] @@ -133,17 +133,7 @@ zip = { version = "0.6.4", optional = true } [features] default = ["analytics", "meilisearch-types/all-tokenizations", "mini-dashboard"] analytics = ["segment"] -mini-dashboard = [ - "actix-web-static-files", - "static-files", - "anyhow", - "cargo_toml", - "hex", - "reqwest", - "sha-1", - "tempfile", - "zip", -] +mini-dashboard = ["actix-web-static-files", "static-files", "anyhow", "cargo_toml", "hex", "reqwest", "sha-1", "tempfile", "zip"] chinese = ["meilisearch-types/chinese"] hebrew = ["meilisearch-types/hebrew"] japanese = ["meilisearch-types/japanese"] diff --git a/meilisearch/src/main.rs b/meilisearch/src/main.rs index d6b9f027d..b0ca9dd7b 100644 --- a/meilisearch/src/main.rs +++ b/meilisearch/src/main.rs @@ -1,5 +1,5 @@ use std::env; -use std::io::Write; +use std::io::{stderr, Write}; use std::path::PathBuf; use std::sync::Arc; @@ -7,6 +7,7 @@ use actix_web::http::KeepAlive; use actix_web::web::Data; use actix_web::HttpServer; use index_scheduler::IndexScheduler; +use is_terminal::IsTerminal; use meilisearch::analytics::Analytics; use meilisearch::{analytics, create_app, prototype_name, setup_meilisearch, Opt}; use meilisearch_auth::{generate_master_key, AuthController, MASTER_KEY_MIN_SIZE}; @@ -197,8 +198,7 @@ const WARNING_BG_COLOR: Option = Some(Color::Ansi256(178)); const WARNING_FG_COLOR: Option = Some(Color::Ansi256(0)); fn print_master_key_too_short_warning() { - let choice = - if atty::is(atty::Stream::Stderr) { ColorChoice::Auto } else { ColorChoice::Never }; + let choice = if stderr().is_terminal() { ColorChoice::Auto } else { ColorChoice::Never }; let mut stderr = StandardStream::stderr(choice); stderr .set_color( @@ -223,8 +223,7 @@ fn print_master_key_too_short_warning() { } fn print_missing_master_key_warning() { - let choice = - if atty::is(atty::Stream::Stderr) { ColorChoice::Auto } else { ColorChoice::Never }; + let choice = if stderr().is_terminal() { ColorChoice::Auto } else { ColorChoice::Never }; let mut stderr = StandardStream::stderr(choice); stderr .set_color( From e7f8daaf86601d557947e0f27c2a56cc81da96b8 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 3 Jul 2023 17:09:29 +0200 Subject: [PATCH 2/3] Update criterion to 0.5.1 to remove the atty dependency --- Cargo.lock | 69 ++++------------------------------- benchmarks/Cargo.toml | 2 +- flatten-serde-json/Cargo.toml | 2 +- json-depth-checker/Cargo.toml | 2 +- 4 files changed, 11 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bcfe40cd3..bb6105741 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -428,17 +428,6 @@ dependencies = [ "critical-section", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -773,18 +762,6 @@ dependencies = [ "inout", ] -[[package]] -name = "clap" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" -dependencies = [ - "bitflags 1.3.2", - "clap_lex 0.2.4", - "indexmap", - "textwrap", -] - [[package]] name = "clap" version = "4.3.0" @@ -805,7 +782,7 @@ dependencies = [ "anstream", "anstyle", "bitflags 1.3.2", - "clap_lex 0.5.0", + "clap_lex", "strsim", ] @@ -821,15 +798,6 @@ dependencies = [ "syn 2.0.18", ] -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - [[package]] name = "clap_lex" version = "0.5.0" @@ -935,19 +903,19 @@ dependencies = [ [[package]] name = "criterion" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c76e09c1aae2bc52b3d2f29e13c6572553b30c4aa1b8a49fd70de6412654cb" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" dependencies = [ "anes", - "atty", "cast", "ciborium", - "clap 3.2.25", + "clap", "criterion-plot", + "is-terminal", "itertools", - "lazy_static", "num-traits", + "once_cell", "oorandom", "plotters", "rayon", @@ -1614,7 +1582,7 @@ name = "fuzzers" version = "1.3.0" dependencies = [ "arbitrary", - "clap 4.3.0", + "clap", "fastrand", "milli", "serde", @@ -1811,15 +1779,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.2.6" @@ -2561,7 +2520,7 @@ dependencies = [ "byte-unit", "bytes", "cargo_toml", - "clap 4.3.0", + "clap", "crossbeam-channel", "deserr", "dump", @@ -2933,12 +2892,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "os_str_bytes" -version = "6.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" - [[package]] name = "page_size" version = "0.4.2" @@ -3973,12 +3926,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - [[package]] name = "thiserror" version = "1.0.40" diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index aa4229e05..330947b34 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -18,7 +18,7 @@ mimalloc = { version = "0.1.36", default-features = false } serde_json = { version = "1.0.95", features = ["preserve_order"] } [dev-dependencies] -criterion = { version = "0.4.0", features = ["html_reports"] } +criterion = { version = "0.5.1", features = ["html_reports"] } rand = "0.8.5" rand_chacha = "0.3.1" roaring = "0.10.1" diff --git a/flatten-serde-json/Cargo.toml b/flatten-serde-json/Cargo.toml index 1ad00b0b3..7b498ec4f 100644 --- a/flatten-serde-json/Cargo.toml +++ b/flatten-serde-json/Cargo.toml @@ -16,7 +16,7 @@ license.workspace = true serde_json = "1.0" [dev-dependencies] -criterion = { version = "0.4.0", features = ["html_reports"] } +criterion = { version = "0.5.1", features = ["html_reports"] } [[bench]] name = "benchmarks" diff --git a/json-depth-checker/Cargo.toml b/json-depth-checker/Cargo.toml index 01b2d03a7..b8162357b 100644 --- a/json-depth-checker/Cargo.toml +++ b/json-depth-checker/Cargo.toml @@ -15,7 +15,7 @@ license.workspace = true serde_json = "1.0" [dev-dependencies] -criterion = "0.4.0" +criterion = "0.5.1" [[bench]] name = "depth" From a442af6a7c8d225790c860ca55c35b368b03a2fa Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 3 Jul 2023 17:10:05 +0200 Subject: [PATCH 3/3] Update the features of the either dependency to compile milli successfully --- milli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/milli/Cargo.toml b/milli/Cargo.toml index ce3070e5d..bc1d9b7ee 100644 --- a/milli/Cargo.toml +++ b/milli/Cargo.toml @@ -21,7 +21,7 @@ charabia = { version = "0.8.1", default-features = false } concat-arrays = "0.1.2" crossbeam-channel = "0.5.8" deserr = "0.5.0" -either = "1.8.1" +either = { version = "1.8.1", features = ["serde"] } flatten-serde-json = { path = "../flatten-serde-json" } fst = "0.4.7" fxhash = "0.2.1"