diff --git a/Cargo.lock b/Cargo.lock index 471ad66..d1e97d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,22 +4,13 @@ version = 4 [[package]] name = "aho-corasick" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" dependencies = [ "memchr", ] -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "anstyle" version = "1.0.14" @@ -28,15 +19,15 @@ checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anyhow" -version = "1.0.102" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] name = "assert_cmd" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39bae1d3fa576f7c6519514180a72559268dd7d1fe104070956cb687bc6673bd" +checksum = "2aa3a22042e45de04255c7bf3626e239f450200fd0493c1e382263544b20aea6" dependencies = [ "anstyle", "bstr", @@ -49,73 +40,38 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" [[package]] name = "bitflags" -version = "2.11.1" +version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" [[package]] name = "bstr" -version = "1.12.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" +checksum = "a680398c10c7bc0488067c4612226ea905a85f607134b69f3068d505d58c4214" dependencies = [ "memchr", "regex-automata", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" - -[[package]] -name = "cc" -version = "1.2.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d" -dependencies = [ - "find-msvc-tools", - "shlex", + "serde_core", ] [[package]] name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - -[[package]] -name = "chrono" -version = "0.4.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-link", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" [[package]] name = "crossbeam-deque" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -123,18 +79,18 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.18" +version = "0.9.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.21" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" [[package]] name = "difflib" @@ -144,21 +100,15 @@ checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" [[package]] name = "either" -version = "1.16.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] name = "errno" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" dependencies = [ "libc", "windows-sys", @@ -166,26 +116,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" - -[[package]] -name = "filetime" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98844151eee8917efc50bd9e8318cb963ae8b297431495d3f758616ea5c57db" -dependencies = [ - "cfg-if", - "libc", - "libredox", -] - -[[package]] -name = "find-msvc-tools" -version = "0.1.9" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" [[package]] name = "float-cmp" @@ -196,136 +129,69 @@ dependencies = [ "num-traits", ] -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] -name = "futures-core" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" - -[[package]] -name = "futures-task" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" - -[[package]] -name = "futures-util" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" -dependencies = [ - "futures-core", - "futures-task", - "pin-project-lite", - "slab", -] - [[package]] name = "getrandom" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", "libc", "r-efi", - "wasip2", - "wasip3", -] - -[[package]] -name = "hashbrown" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "foldhash", ] [[package]] -name = "hashbrown" -version = "0.17.0" +name = "jiff" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "iana-time-zone" -version = "0.1.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e" dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", + "jiff-core", + "jiff-static", + "jiff-tzdb-platform", "log", - "wasm-bindgen", - "windows-core", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link", ] [[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" +name = "jiff-core" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8" dependencies = [ - "cc", + "log", ] [[package]] -name = "id-arena" -version = "2.3.0" +name = "jiff-static" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" - -[[package]] -name = "indexmap" -version = "2.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +checksum = "c0127e9bde3c6130d6169e7d8d68676e4be69c4bf7573c308b6f960a5089c428" dependencies = [ - "equivalent", - "hashbrown 0.17.0", - "serde", - "serde_core", + "jiff-core", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "itoa" -version = "1.0.18" +name = "jiff-tzdb" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc" [[package]] -name = "js-sys" -version = "0.3.97" +name = "jiff-tzdb-platform" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf" +checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e" dependencies = [ - "cfg-if", - "futures-util", - "once_cell", - "wasm-bindgen", + "jiff-tzdb", ] -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - [[package]] name = "lexopt" version = "0.3.2" @@ -334,21 +200,9 @@ checksum = "803ec87c9cfb29b9d2633f20cba1f488db3fd53f2158b1024cbefb47ba05d413" [[package]] name = "libc" -version = "0.2.186" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" - -[[package]] -name = "libredox" -version = "0.1.16" +version = "0.2.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" -dependencies = [ - "bitflags", - "libc", - "plain", - "redox_syscall", -] +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" [[package]] name = "linux-raw-sys" @@ -358,15 +212,15 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "log" -version = "0.4.29" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" [[package]] name = "memchr" -version = "2.8.0" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "normalize-line-endings" @@ -393,22 +247,25 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" name = "p2" version = "0.1.0" dependencies = [ - "filetime", + "jiff", "libc", "rayon", ] [[package]] -name = "pin-project-lite" -version = "0.2.17" +name = "portable-atomic" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" [[package]] -name = "plain" -version = "0.2.3" +name = "portable-atomic-util" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] [[package]] name = "predicates" @@ -440,21 +297,11 @@ dependencies = [ "termtree", ] -[[package]] -name = "prettyplease" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" -dependencies = [ - "proc-macro2", - "syn", -] - [[package]] name = "proc-macro2" -version = "1.0.106" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] @@ -465,8 +312,7 @@ version = "0.1.0" dependencies = [ "anyhow", "assert_cmd", - "chrono", - "filetime", + "jiff", "lexopt", "libc", "p2", @@ -478,9 +324,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.45" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] @@ -511,20 +357,11 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "redox_syscall" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f450ad9c3b1da563fb6948a8e0fb0fb9269711c9c73d9ea1de5058c79c8d643a" -dependencies = [ - "bitflags", -] - [[package]] name = "regex" -version = "1.12.3" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857" dependencies = [ "aho-corasick", "memchr", @@ -534,9 +371,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.14" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158" dependencies = [ "aho-corasick", "memchr", @@ -545,15 +382,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.10" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" +checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" [[package]] name = "rustix" -version = "1.1.4" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ "bitflags", "errno", @@ -562,12 +399,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "rustversion" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" - [[package]] name = "same-file" version = "1.0.6" @@ -577,71 +408,37 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "semver" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" - -[[package]] -name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", -] - [[package]] name = "serde_core" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "serde_json" -version = "1.0.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - [[package]] name = "syn" -version = "2.0.117" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" dependencies = [ "proc-macro2", "quote", @@ -669,15 +466,9 @@ checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" [[package]] name = "unicode-ident" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" - -[[package]] -name = "unicode-xid" -version = "0.2.6" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" [[package]] name = "wait-timeout" @@ -698,103 +489,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wasip2" -version = "1.0.3+wasi-0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" -dependencies = [ - "wit-bindgen 0.57.1", -] - -[[package]] -name = "wasip3" -version = "0.4.0+wasi-0.3.0-rc-2026-01-06" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" -dependencies = [ - "wit-bindgen 0.51.0", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wasm-encoder" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" -dependencies = [ - "leb128fmt", - "wasmparser", -] - -[[package]] -name = "wasm-metadata" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" -dependencies = [ - "anyhow", - "indexmap", - "wasm-encoder", - "wasmparser", -] - -[[package]] -name = "wasmparser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" -dependencies = [ - "bitflags", - "hashbrown 0.15.5", - "indexmap", - "semver", -] - [[package]] name = "winapi-util" version = "0.1.11" @@ -804,65 +498,12 @@ dependencies = [ "windows-sys", ] -[[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", -] - -[[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", -] - [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "windows-sys" version = "0.61.2" @@ -871,103 +512,3 @@ checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ "windows-link", ] - -[[package]] -name = "wit-bindgen" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" -dependencies = [ - "wit-bindgen-rust-macro", -] - -[[package]] -name = "wit-bindgen" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" - -[[package]] -name = "wit-bindgen-core" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" -dependencies = [ - "anyhow", - "heck", - "wit-parser", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" -dependencies = [ - "anyhow", - "heck", - "indexmap", - "prettyplease", - "syn", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" -dependencies = [ - "anyhow", - "prettyplease", - "proc-macro2", - "quote", - "syn", - "wit-bindgen-core", - "wit-bindgen-rust", -] - -[[package]] -name = "wit-component" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" -dependencies = [ - "anyhow", - "bitflags", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder", - "wasm-metadata", - "wasmparser", - "wit-parser", -] - -[[package]] -name = "wit-parser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] - -[[package]] -name = "zmij" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml index 065c1a4..b0b2b18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "q" version = "0.1.0" edition = "2024" license = "GPL-3.0-or-later" +rust-version = "1.99" [[bin]] name = "quilt" @@ -14,15 +15,21 @@ path = "src/bin/guards.rs" [dependencies] anyhow = "1.0.102" -chrono = "0.4.44" -filetime = "0.2.27" +jiff = "1.0.1" lexopt = "0.3.2" -libc = "0.2.186" p2 = { path = "p2" } shlex = "1.3.0" tempfile = "3.27.0" walkdir = "2.5.0" +[target.'cfg(unix)'.dependencies] +libc = "0.2.186" + [dev-dependencies] assert_cmd = "2.2.1" predicates = "3.1.4" + +[profile.release] +panic = "abort" +codegen-units = 1 +lto = "fat" diff --git a/p2/Cargo.lock b/p2/Cargo.lock index 142d314..5c8e2d4 100644 --- a/p2/Cargo.lock +++ b/p2/Cargo.lock @@ -2,17 +2,11 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - [[package]] name = "crossbeam-deque" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -20,50 +14,131 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.18" +version = "0.9.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.21" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" [[package]] name = "either" -version = "1.16.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] -name = "filetime" -version = "0.2.29" +name = "jiff" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" +checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e" dependencies = [ - "cfg-if", - "libc", + "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", +] + +[[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]] name = "libc" -version = "0.2.186" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "log" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" [[package]] name = "p2" version = "0.1.0" dependencies = [ - "filetime", + "jiff", "libc", "rayon", ] +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +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]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + [[package]] name = "rayon" version = "1.12.0" @@ -83,3 +158,46 @@ dependencies = [ "crossbeam-deque", "crossbeam-utils", ] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" diff --git a/p2/Cargo.toml b/p2/Cargo.toml index 13081b1..ab01774 100644 --- a/p2/Cargo.toml +++ b/p2/Cargo.toml @@ -4,8 +4,9 @@ version = "0.1.0" edition = "2024" description = "A Rust implementation of GNU patch-compatible patch application" license = "GPL-3.0-or-later" +rust-version = "1.99" [dependencies] -filetime = "0.2" +jiff = "1.0.1" libc = "0.2" rayon = "1.10" diff --git a/p2/src/apply.rs b/p2/src/apply.rs index 848120d..7a0eea5 100644 --- a/p2/src/apply.rs +++ b/p2/src/apply.rs @@ -2,8 +2,8 @@ use std::borrow::Cow; use std::collections::{HashMap, HashSet}; use std::fs; use std::path::{Path, PathBuf}; +use std::time::SystemTime; -use filetime::set_file_mtime; use rayon::prelude::*; use crate::fs_util::{ @@ -29,7 +29,7 @@ use crate::timestamp::{ use crate::{ ApplyOptions, ApplyReport, FilePatch, FileReport, GitOperation, Hunk, HunkLine, HunkReport, HunkStatus, MergeMode, PatchFormat, PatchSet, ReadOnlyBehavior, ReportOperation, Result, - io_error, + io_error, io_error_other, }; /// Patch sets touching at least this many distinct files apply files in parallel. @@ -500,7 +500,9 @@ fn apply_file_patch( && !time_mismatch && let Some(timestamp) = target_timestamp { - set_file_mtime(&full_path, timestamp).map_err(io_error(&full_path))?; + let mtime: SystemTime = timestamp.try_into().map_err(io_error_other(&full_path))?; + fs::set_times(&full_path, fs::FileTimes::new().set_modified(mtime)) + .map_err(io_error(&full_path))?; } } diff --git a/p2/src/lib.rs b/p2/src/lib.rs index a4f2528..df64413 100644 --- a/p2/src/lib.rs +++ b/p2/src/lib.rs @@ -385,6 +385,17 @@ pub(crate) fn io_error(path: &Path) -> impl FnOnce(std::io::Error) -> Error + '_ } } +/// Builds an `Error::Io` mapper for `path` and an arbitrary error (flagged as "Other" IO error), for use with `map_err`. +pub(crate) fn io_error_other(path: &Path) -> impl FnOnce(E) -> Error + '_ +where + E: Into>, +{ + move |source| Error::Io { + path: path.to_path_buf(), + source: std::io::Error::new(std::io::ErrorKind::Other, source), + } +} + /// The paths `apply_patch` would write to, in patch order. pub fn affected_paths( root: impl AsRef, diff --git a/p2/src/timestamp.rs b/p2/src/timestamp.rs index 5cc7322..856fbf4 100644 --- a/p2/src/timestamp.rs +++ b/p2/src/timestamp.rs @@ -5,9 +5,9 @@ use std::fs; use std::path::Path; use std::str::FromStr; -use filetime::FileTime; +use jiff::Timestamp; -use crate::{ApplyOptions, FilePatch, Result, io_error}; +use crate::{ApplyOptions, FilePatch, Result, io_error, io_error_other}; #[derive(Clone, Copy)] pub(crate) enum TimestampMode { @@ -61,10 +61,10 @@ pub(crate) fn has_deletion_timestamp(patch: &FilePatch, options: &ApplyOptions) .and_then(|label| parse_header_timestamp(label, mode.unwrap_or(TimestampMode::Local))); timestamp.is_some_and(|timestamp| { if mode.is_some() { - timestamp.seconds() == 0 + timestamp.as_second() == 0 } else { // GNU patch allows for an epoch written in a different local timezone. - let time = (timestamp.seconds(), timestamp.nanoseconds()); + let time = (timestamp.as_second(), timestamp.subsec_nanosecond()); time > (-25 * 3600, 0) && time < (26 * 3600, 0) } }) @@ -74,7 +74,7 @@ pub(crate) fn source_timestamp( patch: &FilePatch, reverse: bool, mode: Option, -) -> Option { +) -> Option { parse_header_timestamp(source_label(patch, reverse)?, mode?) } @@ -82,21 +82,23 @@ pub(crate) fn target_timestamp( patch: &FilePatch, reverse: bool, mode: Option, -) -> Option { +) -> Option { parse_header_timestamp(target_label(patch, reverse)?, mode?) } pub(crate) fn source_timestamp_matches( path: &Path, existed: bool, - timestamp: Option, + timestamp: Option, ) -> Result { let Some(timestamp) = timestamp.filter(|_| existed) else { return Ok(true); }; let metadata = fs::metadata(path).map_err(io_error(path))?; - let actual = FileTime::from_last_modification_time(&metadata); - Ok(actual.seconds() == timestamp.seconds() && actual.nanoseconds() == timestamp.nanoseconds()) + let mtime_sys = metadata.modified().map_err(io_error(path))?; + let mtime: Timestamp = mtime_sys.try_into().map_err(io_error_other(path))?; + + Ok(mtime == timestamp) } struct DateTime { @@ -144,7 +146,7 @@ unsafe extern "C" { } /// Parses a `YYYY-MM-DD HH:MM:SS[.fraction][ zone]` header label. -pub(crate) fn parse_header_timestamp(label: &str, mode: TimestampMode) -> Option { +pub(crate) fn parse_header_timestamp(label: &str, mode: TimestampMode) -> Option { let timestamp = label.trim_start(); let datetime = timestamp.get(..19)?; let bytes = datetime.as_bytes(); @@ -174,15 +176,16 @@ pub(crate) fn parse_header_timestamp(label: &str, mode: TimestampMode) -> Option } let (nanoseconds, timezone_offset) = parse_timestamp_suffix(×tamp[19..])?; let seconds = match (timezone_offset, mode) { - (Some(offset), _) => datetime.utc_seconds()?.checked_sub(offset)?, + (Some(offset), _) => datetime.utc_seconds()?.checked_sub(offset as i64)?, (None, TimestampMode::Utc) => datetime.utc_seconds()?, (None, TimestampMode::Local) => datetime.local_seconds()?, }; - Some(FileTime::from_unix_time(seconds, nanoseconds)) + + Some(Timestamp::constant(seconds, nanoseconds)) } /// Parses the optional `.fraction` and timezone that follow the seconds. -fn parse_timestamp_suffix(suffix: &str) -> Option<(u32, Option)> { +fn parse_timestamp_suffix(suffix: &str) -> Option<(i32, Option)> { let mut rest = suffix; let mut nanoseconds = 0; if let Some(fraction) = rest.strip_prefix('.') { @@ -194,8 +197,8 @@ fn parse_timestamp_suffix(suffix: &str) -> Option<(u32, Option)> { nanoseconds = fraction .bytes() .take(parsed_digits) - .fold(0, |value, byte| value * 10 + u32::from(byte - b'0')) - * 10u32.pow((9 - parsed_digits) as u32); + .fold(0, |value, byte| value * 10 + i32::from(byte - b'0')) + * 10i32.pow((9 - parsed_digits) as u32); rest = &fraction[digit_count..]; } @@ -208,7 +211,7 @@ fn parse_timestamp_suffix(suffix: &str) -> Option<(u32, Option)> { Some((nanoseconds, timezone_offset)) } -fn parse_timezone_offset(value: &str) -> Option { +fn parse_timezone_offset(value: &str) -> Option { if ["UTC", "GMT", "UT", "Z"] .iter() .any(|zone| value.eq_ignore_ascii_case(zone)) @@ -234,8 +237,8 @@ fn parse_timezone_offset(value: &str) -> Option { } else { return None; }; - let hours: i64 = parse_digits(hours)?; - let minutes: i64 = parse_digits(minutes)?; + let hours: i32 = parse_digits(hours)?; + let minutes: i32 = parse_digits(minutes)?; if hours > 25 || minutes > 59 { return None; } @@ -285,7 +288,7 @@ mod tests { let timestamp = parse_header_timestamp("2009-03-14 01:00:00.123456789 +0100", TimestampMode::Utc) .unwrap(); - assert_eq!(timestamp.seconds(), 1_236_988_800); - assert_eq!(timestamp.nanoseconds(), 123_456_789); + assert_eq!(timestamp.as_second(), 1_236_988_800); + assert_eq!(timestamp.subsec_nanosecond(), 123_456_789); } } diff --git a/p2/tests/parity.rs b/p2/tests/parity.rs index d139052..d039a61 100644 --- a/p2/tests/parity.rs +++ b/p2/tests/parity.rs @@ -1,12 +1,13 @@ use std::fs; use std::path::Path; +use std::time::{Duration, SystemTime}; + +use jiff::Timestamp; mod support; use support::*; -use filetime::{FileTime, set_file_mtime}; - #[cfg(unix)] use std::os::unix::fs::PermissionsExt; #[cfg(unix)] @@ -1870,9 +1871,11 @@ fn sets_utc_timestamp_from_patch_header_like_gnu_patch() { fs::create_dir(&p2_dir).unwrap(); fs::write(gnu_dir.join("f"), "one\n").unwrap(); fs::write(p2_dir.join("f"), "one\n").unwrap(); - let timestamp1 = FileTime::from_unix_time(1_236_902_400, 0); - set_file_mtime(gnu_dir.join("f"), timestamp1).unwrap(); - set_file_mtime(p2_dir.join("f"), timestamp1).unwrap(); + + let timestamp1 = SystemTime::UNIX_EPOCH + Duration::from_secs(1_236_902_400); + let filetimes1 = fs::FileTimes::new().set_modified(timestamp1); + fs::set_times(gnu_dir.join("f"), filetimes1).unwrap(); + fs::set_times(p2_dir.join("f"), filetimes1).unwrap(); let p2 = patch_under_test(); let reference = reference_patch(); @@ -1895,8 +1898,8 @@ fn sets_utc_timestamp_from_patch_header_like_gnu_patch() { fs::read(p2_dir.join("f")).unwrap() ); assert_eq!( - FileTime::from_last_modification_time(&fs::metadata(gnu_dir.join("f")).unwrap()).seconds(), - FileTime::from_last_modification_time(&fs::metadata(p2_dir.join("f")).unwrap()).seconds() + fs::metadata(gnu_dir.join("f")).unwrap().modified().unwrap(), + fs::metadata(p2_dir.join("f")).unwrap().modified().unwrap() ); fs::remove_dir_all(root).unwrap(); @@ -1912,9 +1915,10 @@ fn sets_fractional_timestamp_with_timezone_like_gnu_patch() { fs::create_dir(&p2_dir).unwrap(); fs::write(gnu_dir.join("f"), "one\n").unwrap(); fs::write(p2_dir.join("f"), "one\n").unwrap(); - let timestamp1 = FileTime::from_unix_time(1_236_902_400, 0); - set_file_mtime(gnu_dir.join("f"), timestamp1).unwrap(); - set_file_mtime(p2_dir.join("f"), timestamp1).unwrap(); + let timestamp1 = SystemTime::UNIX_EPOCH + Duration::from_secs(1_236_902_400); + let filetimes1 = fs::FileTimes::new().set_modified(timestamp1); + fs::set_times(gnu_dir.join("f"), filetimes1).unwrap(); + fs::set_times(p2_dir.join("f"), filetimes1).unwrap(); let p2 = patch_under_test(); let reference = reference_patch(); @@ -1927,10 +1931,20 @@ fn sets_fractional_timestamp_with_timezone_like_gnu_patch() { String::from_utf8_lossy(&gnu.stderr), String::from_utf8_lossy(&ours.stderr) ); - let gnu_time = FileTime::from_last_modification_time(&fs::metadata(gnu_dir.join("f")).unwrap()); - let p2_time = FileTime::from_last_modification_time(&fs::metadata(p2_dir.join("f")).unwrap()); - assert_eq!(gnu_time.seconds(), p2_time.seconds()); - assert_eq!(gnu_time.nanoseconds(), p2_time.nanoseconds()); + let gnu_time: Timestamp = fs::metadata(gnu_dir.join("f")) + .unwrap() + .modified() + .unwrap() + .try_into() + .unwrap(); + let p2_time: Timestamp = fs::metadata(p2_dir.join("f")) + .unwrap() + .modified() + .unwrap() + .try_into() + .unwrap(); + assert_eq!(gnu_time.as_second(), p2_time.as_second()); + assert_eq!(gnu_time.subsec_nanosecond(), p2_time.subsec_nanosecond()); fs::remove_dir_all(root).unwrap(); } @@ -1948,9 +1962,10 @@ fn sets_timestamp_with_named_zero_timezone_like_gnu_patch() { fs::create_dir(&p2_dir).unwrap(); fs::write(gnu_dir.join("f"), "one\n").unwrap(); fs::write(p2_dir.join("f"), "one\n").unwrap(); - let timestamp1 = FileTime::from_unix_time(1_236_902_400, 0); - set_file_mtime(gnu_dir.join("f"), timestamp1).unwrap(); - set_file_mtime(p2_dir.join("f"), timestamp1).unwrap(); + let timestamp1 = SystemTime::UNIX_EPOCH + Duration::from_secs(1_236_902_400); + let filetimes1 = fs::FileTimes::new().set_modified(timestamp1); + fs::set_times(gnu_dir.join("f"), filetimes1).unwrap(); + fs::set_times(p2_dir.join("f"), filetimes1).unwrap(); let p2 = patch_under_test(); let reference = reference_patch(); @@ -1963,12 +1978,20 @@ fn sets_timestamp_with_named_zero_timezone_like_gnu_patch() { String::from_utf8_lossy(&gnu.stderr), String::from_utf8_lossy(&ours.stderr) ); - let gnu_time = - FileTime::from_last_modification_time(&fs::metadata(gnu_dir.join("f")).unwrap()); - let p2_time = - FileTime::from_last_modification_time(&fs::metadata(p2_dir.join("f")).unwrap()); - assert_eq!(gnu_time.seconds(), p2_time.seconds(), "zone {zone}"); - assert_eq!(gnu_time.seconds(), 1_236_988_800, "zone {zone}"); + let gnu_time: Timestamp = fs::metadata(gnu_dir.join("f")) + .unwrap() + .modified() + .unwrap() + .try_into() + .unwrap(); + let p2_time: Timestamp = fs::metadata(p2_dir.join("f")) + .unwrap() + .modified() + .unwrap() + .try_into() + .unwrap(); + assert_eq!(gnu_time.as_second(), p2_time.as_second(), "zone {zone}"); + assert_eq!(gnu_time.as_second(), 1_236_988_800, "zone {zone}"); fs::remove_dir_all(root).unwrap(); } @@ -1985,9 +2008,10 @@ fn short_set_utc_option_sets_timestamp_like_gnu_patch() { fs::create_dir(&p2_dir).unwrap(); fs::write(gnu_dir.join("f"), "one\n").unwrap(); fs::write(p2_dir.join("f"), "one\n").unwrap(); - let timestamp1 = FileTime::from_unix_time(1_236_902_400, 0); - set_file_mtime(gnu_dir.join("f"), timestamp1).unwrap(); - set_file_mtime(p2_dir.join("f"), timestamp1).unwrap(); + let timestamp1 = SystemTime::UNIX_EPOCH + Duration::from_secs(1_236_902_400); + let filetimes1 = fs::FileTimes::new().set_modified(timestamp1); + fs::set_times(gnu_dir.join("f"), filetimes1).unwrap(); + fs::set_times(p2_dir.join("f"), filetimes1).unwrap(); let p2 = patch_under_test(); let reference = reference_patch(); @@ -2000,9 +2024,19 @@ fn short_set_utc_option_sets_timestamp_like_gnu_patch() { String::from_utf8_lossy(&gnu.stderr), String::from_utf8_lossy(&ours.stderr) ); - let gnu_time = FileTime::from_last_modification_time(&fs::metadata(gnu_dir.join("f")).unwrap()); - let p2_time = FileTime::from_last_modification_time(&fs::metadata(p2_dir.join("f")).unwrap()); - assert_eq!(gnu_time.seconds(), p2_time.seconds()); + let gnu_time: Timestamp = fs::metadata(gnu_dir.join("f")) + .unwrap() + .modified() + .unwrap() + .try_into() + .unwrap(); + let p2_time: Timestamp = fs::metadata(p2_dir.join("f")) + .unwrap() + .modified() + .unwrap() + .try_into() + .unwrap(); + assert_eq!(gnu_time.as_second(), p2_time.as_second()); fs::remove_dir_all(root).unwrap(); } @@ -2018,9 +2052,10 @@ fn set_time_uses_local_timezone_like_gnu_patch() { fs::create_dir(&p2_dir).unwrap(); fs::write(gnu_dir.join("f"), "one\n").unwrap(); fs::write(p2_dir.join("f"), "one\n").unwrap(); - let source_time = FileTime::from_unix_time(1_236_920_400, 0); - set_file_mtime(gnu_dir.join("f"), source_time).unwrap(); - set_file_mtime(p2_dir.join("f"), source_time).unwrap(); + let source_time = SystemTime::UNIX_EPOCH + Duration::from_secs(1_236_920_400); + let source_file_times = fs::FileTimes::new().set_modified(source_time); + fs::set_times(gnu_dir.join("f"), source_file_times).unwrap(); + fs::set_times(p2_dir.join("f"), source_file_times).unwrap(); let p2 = patch_under_test(); let reference = reference_patch(); @@ -2038,6 +2073,7 @@ fn set_time_uses_local_timezone_like_gnu_patch() { &["-p1", "--set-time"], &[("TZ", "EST5")], ); + assert_eq!( gnu.status.success(), ours.status.success(), @@ -2045,10 +2081,20 @@ fn set_time_uses_local_timezone_like_gnu_patch() { String::from_utf8_lossy(&gnu.stderr), String::from_utf8_lossy(&ours.stderr) ); - let gnu_time = FileTime::from_last_modification_time(&fs::metadata(gnu_dir.join("f")).unwrap()); - let p2_time = FileTime::from_last_modification_time(&fs::metadata(p2_dir.join("f")).unwrap()); - assert_eq!(gnu_time.seconds(), p2_time.seconds()); - assert_eq!(gnu_time.seconds(), 1_237_006_800); + let gnu_time: Timestamp = fs::metadata(gnu_dir.join("f")) + .unwrap() + .modified() + .unwrap() + .try_into() + .unwrap(); + let p2_time: Timestamp = fs::metadata(p2_dir.join("f")) + .unwrap() + .modified() + .unwrap() + .try_into() + .unwrap(); + assert_eq!(gnu_time.as_second(), p2_time.as_second()); + assert_eq!(gnu_time.as_second(), 1_237_006_800); fs::remove_dir_all(root).unwrap(); } diff --git a/src/apply.rs b/src/apply.rs index 9e2a88b..b8654b0 100644 --- a/src/apply.rs +++ b/src/apply.rs @@ -11,6 +11,7 @@ use std::collections::HashSet; use std::fs::{self, File}; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; +use std::time::SystemTime; use tempfile::{NamedTempFile, TempDir, tempdir}; pub struct ApplyResult { @@ -519,7 +520,7 @@ fn restore_file( } if consume && fs::rename(&backup, &dest).is_ok() { if !has_other_hard_links(&metadata) { - filetime::set_file_mtime(&dest, filetime::FileTime::now())?; + fs::set_times(&dest, fs::FileTimes::new().set_modified(SystemTime::now()))?; } return Ok(()); } diff --git a/src/commands/mail.rs b/src/commands/mail.rs index 6bbbc64..0e735f7 100644 --- a/src/commands/mail.rs +++ b/src/commands/mail.rs @@ -2,7 +2,7 @@ use crate::cli::usage; use crate::patchfile::patch_header; use crate::state::{PatchEntry, State}; use anyhow::{Context, Result, bail}; -use chrono::{DateTime, Local}; +use jiff::Timestamp; use lexopt::prelude::*; use std::collections::HashMap; use std::env; @@ -341,10 +341,10 @@ fn write_generated_mail_headers(out: &mut String, sender: &str) { domain )); out.push_str(&format!("User-Agent: quilt/{}\n", env!("Q_VERSION"))); - let now: DateTime = Local::now(); + let now: Timestamp = Timestamp::now(); out.push_str(&format!( "Date: {}\n", - now.format("%a, %d %b %Y %H:%M:%S %z") + now.strftime("%a, %d %b %Y %H:%M:%S %z") )); } diff --git a/src/diff.rs b/src/diff.rs index 92966ad..0d51101 100644 --- a/src/diff.rs +++ b/src/diff.rs @@ -3,7 +3,7 @@ use crate::config::*; use crate::patchfile::*; use crate::state::State; use anyhow::{Context, Result, bail}; -use chrono::{DateTime, Local}; +use jiff::Timestamp; use lexopt::ValueExt; use std::collections::{HashMap, HashSet}; use std::ffi::OsString; @@ -538,12 +538,11 @@ fn diff_label_with_timestamp(label: &str, path: &Path, no_timestamps: bool) -> S "1970-01-01 00:00:00.000000000 +0000".to_string() } else { fs::metadata(path) - .and_then(|metadata| metadata.modified()) - .map(|modified| { - let datetime: DateTime = DateTime::from(modified); - datetime.format("%Y-%m-%d %H:%M:%S%.9f %z").to_string() - }) - .unwrap_or_else(|_| "1970-01-01 00:00:00.000000000 +0000".to_string()) + .ok() + .and_then(|metadata| metadata.modified().ok()) + .and_then(|modified| Timestamp::try_from(modified).ok()) + .map(|timestamp| timestamp.strftime("%Y-%m-%d %H:%M:%S%.9f %z").to_string()) + .unwrap_or("1970-01-01 00:00:00.000000000 +0000".to_string()) }; format!("{label}\t{timestamp}") } diff --git a/src/fsutil.rs b/src/fsutil.rs index 86f9c5b..41d6b25 100644 --- a/src/fsutil.rs +++ b/src/fsutil.rs @@ -67,9 +67,17 @@ pub(crate) fn has_other_hard_links(_metadata: &fs::Metadata) -> bool { pub(crate) fn copy_preserving_times(src: &Path, dst: &Path) -> Result<()> { fs::copy(src, dst)?; if let Ok(metadata) = fs::metadata(src) { - let mtime = filetime::FileTime::from_last_modification_time(&metadata); - let atime = filetime::FileTime::from_last_access_time(&metadata); - let _ = filetime::set_file_times(dst, atime, mtime); + let times = fs::FileTimes::new(); + + if let Ok(atime) = metadata.accessed() { + let _ = times.set_accessed(atime); + } + + if let Ok(mtime) = metadata.modified() { + let _ = times.set_modified(mtime); + } + + fs::set_times(&dst, times)?; } Ok(()) } diff --git a/tests/stack.rs b/tests/stack.rs index 970053a..918c759 100644 --- a/tests/stack.rs +++ b/tests/stack.rs @@ -2,6 +2,7 @@ mod common; use common::*; #[cfg(unix)] use std::os::unix::fs::PermissionsExt; +use std::time::{Duration, SystemTime}; #[test] fn create_refresh_pop_and_push_patch() { @@ -1002,12 +1003,13 @@ fn pop_discards_backups() { fn pop_gives_restored_files_a_fresh_mtime() { let dir = applied_hello_patch(); let hello = dir.path().join("hello.txt"); - let old = filetime::FileTime::from_unix_time(1_000_000_000, 0); + let old = SystemTime::UNIX_EPOCH + Duration::from_secs(1_000_000_000); + let old_ft = fs::FileTimes::new().set_modified(old); // Age the backup, as a clone or a long-lived backup would be. - filetime::set_file_mtime(dir.path().join(".pc/change.diff/hello.txt"), old).unwrap(); + fs::set_times(dir.path().join(".pc/change.diff/hello.txt"), old_ft).unwrap(); q(dir.path()).args(["pop"]).assert().success(); assert_eq!(fs::read_to_string(&hello).unwrap(), "old\n"); - let mtime = filetime::FileTime::from_last_modification_time(&fs::metadata(&hello).unwrap()); + let mtime = fs::metadata(&hello).unwrap().modified().unwrap(); assert!(mtime > old, "restored file kept the backup's old mtime"); } diff --git a/tools/benchmark.sh b/tools/benchmark.sh index 4c7054e..844da4f 100755 --- a/tools/benchmark.sh +++ b/tools/benchmark.sh @@ -70,6 +70,7 @@ bench_pair() { out=$tmp_results/$name.md prepare="rm -rf '$run_dir' && cp -a '$template' '$run_dir'" hyperfine \ + --shell default \ --warmup "$warmup" \ --min-runs "$min_runs" \ --prepare "$prepare" \