From e1e3f912b3494724b19a1f446650bbfbd1c49315 Mon Sep 17 00:00:00 2001 From: trinity-1686a Date: Fri, 12 Aug 2022 20:50:08 +0200 Subject: [PATCH] update to v5.0.0 --- Cargo.lock | 261 +++++++++------------------------ crates/arti-testing/Cargo.toml | 1 - crates/arti/Cargo.toml | 2 +- crates/arti/src/reload_cfg.rs | 51 ++++--- maint/cargo_audit | 9 +- 5 files changed, 101 insertions(+), 223 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c5a7d5ac..c410530b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,7 +23,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfe0133578c0986e1fe3dfcd4af1cc5b2dd6c3dbf534d69916ce16a2701d40ba" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cipher", "cpufeatures", ] @@ -54,7 +54,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -85,7 +85,7 @@ dependencies = [ "anyhow", "arti-client", "async-ctrlc", - "cfg-if 1.0.0", + "cfg-if", "clap", "config", "derive_builder_fork_arti", @@ -116,7 +116,7 @@ dependencies = [ "tracing-subscriber", "trust-dns-proto", "visibility", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -212,11 +212,10 @@ dependencies = [ "arti", "arti-client", "async-trait", - "cfg-if 1.0.0", + "cfg-if", "clap", "config", "futures", - "notify", "pin-project", "rand 0.8.5", "rlimit", @@ -326,7 +325,7 @@ dependencies = [ "slab", "socket2", "waker-fn", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -359,13 +358,13 @@ dependencies = [ "async-io", "autocfg", "blocking", - "cfg-if 1.0.0", + "cfg-if", "event-listener", "futures-lite", "libc", "once_cell", "signal-hook", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -475,7 +474,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -492,7 +491,7 @@ checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object", @@ -609,12 +608,6 @@ dependencies = [ "jobserver", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -725,7 +718,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -734,7 +727,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -744,7 +737,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -754,7 +747,7 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] @@ -804,7 +797,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d91974fbbe88ec1df0c24a4f00f99583667a7e2e6272b2b92d294d81e462173" dependencies = [ "nix", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -896,7 +889,7 @@ version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "hashbrown", "lock_api", "once_cell", @@ -1010,7 +1003,7 @@ checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1150,7 +1143,7 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "windows-sys", @@ -1244,25 +1237,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "fsevent" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" -dependencies = [ - "bitflags", - "fsevent-sys", -] - -[[package]] -name = "fsevent-sys" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" -dependencies = [ - "libc", -] - [[package]] name = "fslock" version = "0.2.1" @@ -1270,25 +1244,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04412b8935272e3a9bae6f48c7bfff74c2911f60525404edfdd28e49884c3bfb" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futures" version = "0.3.24" @@ -1430,7 +1388,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.9.0+wasi-snapshot-preview1", ] @@ -1441,7 +1399,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", @@ -1630,9 +1588,9 @@ dependencies = [ [[package]] name = "inotify" -version = "0.7.1" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f" +checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" dependencies = [ "bitflags", "inotify-sys", @@ -1663,16 +1621,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", + "cfg-if", ] [[package]] @@ -1721,13 +1670,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] -name = "kernel32-sys" -version = "0.2.2" +name = "kqueue" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +checksum = "4d6112e8f37b59803ac47a42d14f1f3a59bbf72fc6857ffc5be455e28a691f8e" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" +dependencies = [ + "bitflags", + "libc", ] [[package]] @@ -1748,12 +1707,6 @@ dependencies = [ "spin", ] -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" version = "0.2.132" @@ -1793,7 +1746,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "value-bag", ] @@ -1874,25 +1827,6 @@ dependencies = [ "adler", ] -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - [[package]] name = "mio" version = "0.8.4" @@ -1905,30 +1839,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log", - "mio 0.6.23", - "slab", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - [[package]] name = "nalgebra" version = "0.29.0" @@ -1976,17 +1886,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "net2" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "nix" version = "0.25.0" @@ -1995,7 +1894,7 @@ checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb" dependencies = [ "autocfg", "bitflags", - "cfg-if 1.0.0", + "cfg-if", "libc", ] @@ -2011,20 +1910,18 @@ dependencies = [ [[package]] name = "notify" -version = "4.0.17" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257" +checksum = "ed2c66da08abae1c024c01d635253e402341b4060a12e99b31c7594063bf490a" dependencies = [ "bitflags", "filetime", - "fsevent", - "fsevent-sys", "inotify", + "kqueue", "libc", - "mio 0.6.23", - "mio-extras", + "mio", "walkdir", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2153,7 +2050,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -2223,7 +2120,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", @@ -2379,11 +2276,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899b00b9c8ab553c743b3e11e87c5c7d423b2a2de229ba95b24a756344748011" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "wepoll-ffi", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2600,7 +2497,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2628,7 +2525,7 @@ dependencies = [ "spin", "untrusted 0.7.1", "web-sys", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2809,10 +2706,10 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b291669c8562407a90242395b35409c070f748c64268ed7c837bd0550c4dec5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "thiserror", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2947,7 +2844,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.3", "sha1-asm", @@ -2969,7 +2866,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug", @@ -2981,7 +2878,7 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899bf02746a2c92bf1053d9327dadb252b01af1f81f90cdb902411f518bc7215" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.3", ] @@ -3104,7 +3001,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10c98bba371b9b22a71a9414e420f92ddeb2369239af08200816169d5e2dd7aa" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3211,12 +3108,12 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", "remove_dir_all", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3376,7 +3273,7 @@ dependencies = [ "bytes", "libc", "memchr", - "mio 0.8.4", + "mio", "num_cpus", "once_cell", "parking_lot", @@ -3384,7 +3281,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4025,7 +3922,7 @@ version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4133,7 +4030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" dependencies = [ "async-trait", - "cfg-if 1.0.0", + "cfg-if", "data-encoding", "enum-as-inner", "futures-channel", @@ -4304,7 +4201,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ "same-file", - "winapi 0.3.9", + "winapi", "winapi-util", ] @@ -4336,7 +4233,7 @@ version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -4361,7 +4258,7 @@ version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -4451,12 +4348,6 @@ dependencies = [ "safe_arch", ] -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -4467,12 +4358,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -4485,7 +4370,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4537,16 +4422,6 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "x25519-dalek" version = "2.0.0-pre.1" diff --git a/crates/arti-testing/Cargo.toml b/crates/arti-testing/Cargo.toml index 7599b3dd2..ebd4698f2 100644 --- a/crates/arti-testing/Cargo.toml +++ b/crates/arti-testing/Cargo.toml @@ -25,7 +25,6 @@ cfg-if = "1.0.0" clap = "2.33.0" config = { version = "0.13", default-features = false } futures = "0.3.14" -notify = "4.0" pin-project = "1" rand = "0.8" rlimit = "0.8.3" diff --git a/crates/arti/Cargo.toml b/crates/arti/Cargo.toml index ec4f8d5c6..c9dbe0bd1 100644 --- a/crates/arti/Cargo.toml +++ b/crates/arti/Cargo.toml @@ -54,7 +54,7 @@ fs-mistrust = { path = "../fs-mistrust", version = "0.4.0" } futures = "0.3.14" itertools = "0.10.1" libc = "0.2" -notify = "4.0" +notify = { version = "5.0", default-features = false, features=["macos_kqueue"] } once_cell = { version = "1", optional = true } paste = "1" rlimit = "0.8.3" diff --git a/crates/arti/src/reload_cfg.rs b/crates/arti/src/reload_cfg.rs index cbddbc453..c4fd6b2a4 100644 --- a/crates/arti/src/reload_cfg.rs +++ b/crates/arti/src/reload_cfg.rs @@ -33,6 +33,21 @@ macro_rules! ok_or_break { }; } +/// Generate a rescan FS event +// TODO this function should be removed during a future refactoring; see #562 +#[allow(clippy::unnecessary_wraps)] +fn rescan_event() -> notify::Result { + use notify::event::{EventAttributes, EventKind, Flag}; + + let mut attrs = EventAttributes::default(); + attrs.set_flag(Flag::Rescan); + Ok(notify::Event { + kind: EventKind::Other, + paths: Vec::new(), + attrs, + }) +} + /// Launch a thread to reload our configuration files. /// /// If current configuration requires it, watch for changes in `sources` @@ -51,7 +66,7 @@ pub(crate) fn watch_for_config_changes( // If watching, we must reload the config once right away, because // we have set up the watcher *after* loading the config. // ignore send error, rx can't be disconnected if we are here - let _ = tx.send(notify::DebouncedEvent::Rescan); + let _ = tx.send(rescan_event()); let (watcher, _) = FileWatcher::new_prepared(tx.clone(), DEBOUNCE_INTERVAL, &sources)?; Some(watcher) } else { @@ -67,7 +82,7 @@ pub(crate) fn watch_for_config_changes( client.runtime().spawn(async move { while let Some(()) = sighup_stream.next().await { info!("Received SIGHUP"); - if tx.send(notify::DebouncedEvent::Rescan).is_err() { + if tx.send(rescan_event()).is_err() { warn!("Failed to reload configuration"); break; } @@ -117,7 +132,7 @@ pub(crate) fn watch_for_config_changes( // If watching, we must reload the config once right away, because // we have set up the watcher *after* loading the config. // ignore send error, rx can't be disconnected if we are here - let _ = tx.send(notify::DebouncedEvent::Rescan); + let _ = tx.send(rescan_event()); let (new_watcher, _) = ok_or_break!( FileWatcher::new_prepared(tx.clone(), DEBOUNCE_INTERVAL, &sources), "FS watch: failed to rescan config and re-establish watch: {}", @@ -202,8 +217,11 @@ struct FileWatcher { impl FileWatcher { /// Like `notify::watcher`, but create a FileWatcher instead. - fn new(tx: Sender, interval: Duration) -> anyhow::Result { - let watcher = notify::watcher(tx, interval)?; + fn new(tx: Sender>, interval: Duration) -> anyhow::Result { + let watcher = notify::RecommendedWatcher::new( + tx, + notify::Config::default().with_poll_interval(interval), + )?; Ok(Self { watcher, watching_dirs: HashSet::new(), @@ -213,7 +231,7 @@ impl FileWatcher { /// Create a FileWatcher already watching files in `sources` fn new_prepared( - tx: Sender, + tx: Sender>, interval: Duration, sources: &ConfigurationSources, ) -> anyhow::Result<(Self, FoundConfigFiles)> { @@ -306,25 +324,12 @@ impl FileWatcher { /// Return true if the provided event describes a change affecting one of /// the files that we care about. - fn event_matched(&self, event: ¬ify::DebouncedEvent) -> bool { - let watching = |f: &_| self.watching_files.contains(f); - let watching_or_parent = - |f: &Path| watching(f) || f.parent().map(watching).unwrap_or(false); + fn event_matched(&self, event: ¬ify::Result) -> bool { + let watching = |f| self.watching_files.contains(f); match event { - notify::DebouncedEvent::NoticeWrite(f) => watching(f), - notify::DebouncedEvent::NoticeRemove(f) => watching(f), - notify::DebouncedEvent::Create(f) => watching_or_parent(f), - notify::DebouncedEvent::Write(f) => watching(f), - notify::DebouncedEvent::Chmod(f) => watching(f), - notify::DebouncedEvent::Remove(f) => watching(f), - notify::DebouncedEvent::Rename(f1, f2) => watching(f1) || watching_or_parent(f2), - notify::DebouncedEvent::Rescan => { - // We've missed some events: no choice but to reload. - true - } - notify::DebouncedEvent::Error(_, Some(f)) => watching(f), - notify::DebouncedEvent::Error(_, _) => false, + Ok(event) => event.need_rescan() || event.paths.iter().any(watching), + Err(error) => error.paths.iter().any(watching), } } } diff --git a/maint/cargo_audit b/maint/cargo_audit index c7b126407..c436c519e 100755 --- a/maint/cargo_audit +++ b/maint/cargo_audit @@ -13,11 +13,6 @@ set -euo pipefail # If you add anything to this section, make sure to add a comment # explaining why it's safe to do so. IGNORE=( - # This is not a vulnerability but an unmaintained warn for the - # `net2` crate. It's pulled indirectly by `notify` 4.0. It's - # fixed in `notify` 5.0 however only pre-releases are available - # for now. - --ignore RUSTSEC-2020-0016 # This is not a vulnerability but an unmaintained warning for `ansi_term`. # The upstream issue does not offer good alternatives, and anyway we get # this crate via clap and tracing-*. @@ -29,6 +24,10 @@ ${CARGO:-cargo} audit -D warnings "${IGNORE[@]}" OBSOLETE_IGNORE=( + # This is not a vulnerability but an unmaintained warn for the + # `net2` crate. It was pulled indirectly by `notify` 4.0. + # It's fixed in `notify` 5.0. + --ignore RUSTSEC-2020-0016 # This is not a vulnerability but an unmaintained warn for the # `tempdir` crate. It was pulled by `tls-api` 0.7.0. `tls-api` # 0.8.0 switched to tempfile instead.