From 182d937d3465edc6ef4990342356dbcf7d5a769b Mon Sep 17 00:00:00 2001 From: Andrew Gunnerson Date: Sun, 4 May 2025 18:02:37 -0400 Subject: [PATCH] Update all dependencies This also fixes a number of disabled-by-default clippy warnings and updates the Rust edition to 2024. Signed-off-by: Andrew Gunnerson --- .github/workflows/release.yml | 2 +- Cargo.lock | 253 ++++++++++++++------------------ Cargo.toml | 2 +- avbroot/Cargo.toml | 4 +- avbroot/src/cli/ota.rs | 10 +- avbroot/src/crypto.rs | 1 + avbroot/src/format/bootimage.rs | 1 + avbroot/src/format/lp.rs | 6 +- avbroot/src/format/ota.rs | 2 +- avbroot/src/format/payload.rs | 10 +- avbroot/src/format/sparse.rs | 6 +- avbroot/src/patch/boot.rs | 6 +- avbroot/src/protobuf.rs | 1 + e2e/src/main.rs | 31 ++-- xtask/src/changelog.rs | 6 +- 15 files changed, 157 insertions(+), 184 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 70c7962..28446cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Create release - uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1 + uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2 with: tag_name: v${{ steps.get_version.outputs.version }} name: Version ${{ steps.get_version.outputs.version }} diff --git a/Cargo.lock b/Cargo.lock index d0cc0eb..7829891 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,9 +86,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "arbitrary" @@ -148,12 +148,12 @@ dependencies = [ "regex", "ring", "rsa", - "rustix 1.0.5", + "rustix", "serde", "sha1", "sha2", "tempfile", - "thiserror 2.0.12", + "thiserror", "toml_edit", "topological-sort", "tracing", @@ -211,9 +211,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.11.3" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "531a9155a481e2ee699d4f98f43c0ca4ff8ee1bfd55c31e9e98fb29d2b176fe0" +checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" dependencies = [ "memchr", "regex-automata", @@ -254,9 +254,9 @@ dependencies = [ [[package]] name = "cap-primitives" -version = "3.4.3" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50ad0183a9659850877cefe8f5b87d564b2dd1fe78b18945813687f29c0a6878" +checksum = "0a1e394ed14f39f8bc26f59d4c0c010dbe7f0a1b9bafff451b1f98b67c8af62a" dependencies = [ "ambient-authority", "fs-set-times", @@ -264,32 +264,34 @@ dependencies = [ "io-lifetimes", "ipnet", "maybe-owned", - "rustix 0.38.44", + "rustix", + "rustix-linux-procfs", "windows-sys 0.59.0", "winx", ] [[package]] name = "cap-std" -version = "3.4.3" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c41814365b796ed12688026cb90a1e03236a84ccf009628f9c43c8aa3af250a" +checksum = "07c0355ca583dd58f176c3c12489d684163861ede3c9efa6fd8bba314c984189" dependencies = [ "cap-primitives", "io-extras", "io-lifetimes", - "rustix 0.38.44", + "rustix", ] [[package]] name = "cap-tempfile" -version = "3.4.3" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f95996888e8bb5198a6f27f9f9454244d1ddf4cf82202808ad6b7d570e858e" +checksum = "9bdc50d18ee6c3551b30eb7ad5c4628d7c73ed9e1696b63c432a55602d634d7d" dependencies = [ "cap-std", "rand", - "rustix 0.38.44", + "rustix", + "rustix-linux-procfs", "uuid", ] @@ -304,9 +306,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.18" +version = "1.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525046617d8376e3db1deffb079e91cef90a89fc3ca5c185bbf8c9ecdd15cd5c" +checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" dependencies = [ "jobserver", "libc", @@ -337,9 +339,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.35" +version = "4.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8aa86934b44c19c50f87cc2790e19f54f7a67aedb64101c2e1a2e5ecfb73944" +checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" dependencies = [ "clap_builder", "clap_derive", @@ -347,9 +349,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.35" +version = "4.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2414dbb2dd0695280da6ea9261e327479e9d37b0630f6b53ba2a11c60c679fd9" +checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" dependencies = [ "anstream", "anstyle", @@ -359,9 +361,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.47" +version = "4.5.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06f5378ea264ad4f82bbc826628b5aad714a75abf6ece087e923010eb937fb6" +checksum = "be8c97f3a6f02b9e24cadc12aaba75201d18754b53ea0a9d99642f806ccdb4c9" dependencies = [ "clap", ] @@ -375,7 +377,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -514,9 +516,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ "const-oid", "der_derive", @@ -533,7 +535,7 @@ checksum = "8034092389675178f570469e6c3b0465d3d30b4505c294a6550db47f3c17ad18" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -645,7 +647,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a" dependencies = [ "io-lifetimes", - "rustix 1.0.5", + "rustix", "windows-sys 0.59.0", ] @@ -669,9 +671,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", @@ -715,9 +717,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" [[package]] name = "heck" @@ -819,12 +821,6 @@ dependencies = [ "either", ] -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - [[package]] name = "jobserver" version = "0.1.33" @@ -852,24 +848,24 @@ checksum = "0864a00c8d019e36216b69c2c4ce50b83b7bd966add3cf5ba554ec44f8bebcf5" [[package]] name = "libc" -version = "0.2.171" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "liblzma" -version = "0.3.6" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a631d2b24be269775ba8f7789a6afa1ac228346a20c9e87dbbbe4975a79fd764" +checksum = "66352d7a8ac12d4877b6e6ea5a9b7650ee094257dc40889955bea5bc5b08c1d0" dependencies = [ "liblzma-sys", ] [[package]] name = "liblzma-sys" -version = "0.3.13" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efdadf1a99aceff34553de1461674ab6ac7e7f0843ae9875e339f4a14eb43475" +checksum = "5839bad90c3cc2e0b8c4ed8296b80e86040240f81d46b9c0e9bc8dd51ddd3af1" dependencies = [ "cc", "libc", @@ -878,9 +874,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" +checksum = "c9627da5196e5d8ed0b0495e61e518847578da83483c37288316d9b2e03a7f72" [[package]] name = "libz-rs-sys" @@ -893,15 +889,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.15" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - -[[package]] -name = "linux-raw-sys" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "log" @@ -911,18 +901,18 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "logos" -version = "0.14.4" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7251356ef8cb7aec833ddf598c6cb24d17b689d20b993f9d11a3d764e34e6458" +checksum = "ab6f536c1af4c7cc81edf73da1f8029896e7e1e16a219ef09b184e76a296f3db" dependencies = [ "logos-derive", ] [[package]] name = "logos-codegen" -version = "0.14.4" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f80069600c0d66734f5ff52cc42f2dabd6b29d205f333d61fd7832e9e9963f" +checksum = "189bbfd0b61330abea797e5e9276408f2edbe4f822d7ad08685d67419aafb34e" dependencies = [ "beef", "fnv", @@ -930,14 +920,15 @@ dependencies = [ "proc-macro2", "quote", "regex-syntax", - "syn 2.0.100", + "rustc_version", + "syn 2.0.101", ] [[package]] name = "logos-derive" -version = "0.14.4" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24fb722b06a9dc12adb0963ed585f19fc61dc5413e6a9be9422ef92c091e731d" +checksum = "ebfe8e1a19049ddbfccbd14ac834b215e11b85b90bab0c2dba7c7b92fb5d5cba" dependencies = [ "logos-codegen", ] @@ -974,32 +965,31 @@ dependencies = [ [[package]] name = "miette" -version = "7.5.0" +version = "7.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a955165f87b37fd1862df2a59547ac542c77ef6d17c666f619d1ad22dd89484" +checksum = "5f98efec8807c63c752b5bd61f862c165c115b0a35685bdcfd9238c7aeb592b7" dependencies = [ "cfg-if", "miette-derive", - "thiserror 1.0.69", "unicode-width", ] [[package]] name = "miette-derive" -version = "7.5.0" +version = "7.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf45bf44ab49be92fd1227a3be6fc6f617f1a337c06af54981048574d8783147" +checksum = "db5b29714e950dbb20d5e6f74f9dcec4edbcc1067bb7f8ed198c097b8c1a818b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] name = "miniz_oxide" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff70ce3e48ae43fa075863cef62e8b43b71a4f2382229920e0df362592919430" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" dependencies = [ "adler2", ] @@ -1160,7 +1150,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -1238,14 +1228,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6" dependencies = [ "proc-macro2", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -1276,7 +1266,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.100", + "syn 2.0.101", "tempfile", ] @@ -1290,18 +1280,17 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] name = "prost-reflect" -version = "0.14.7" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5edd582b62f5cde844716e66d92565d7faf7ab1445c8cebce6e00fba83ddb2" +checksum = "ebb644dd3ad12d7cf62a18234d385ea5511ac6abb208704c18098e7e3a5e1b69" dependencies = [ "logos", "miette", - "once_cell", "prost", "prost-types", ] @@ -1317,9 +1306,9 @@ dependencies = [ [[package]] name = "protox" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f352af331bf637b8ecc720f7c87bf903d2571fa2e14a66e9b2558846864b54a" +checksum = "424c2bd294b69c49b949f3619362bc3c5d28298cd1163b6d1a62df37c16461aa" dependencies = [ "bytes", "miette", @@ -1327,19 +1316,19 @@ dependencies = [ "prost-reflect", "prost-types", "protox-parse", - "thiserror 1.0.69", + "thiserror", ] [[package]] name = "protox-parse" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3a462d115462c080ae000c29a47f0b3985737e5d3a995fcdbcaa5c782068dde" +checksum = "57927f9dbeeffcce7192404deee6157a640cbb3fe8ac11eabbe571565949ab75" dependencies = [ "logos", "miette", "prost-types", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1384,7 +1373,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", ] [[package]] @@ -1444,7 +1433,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.15", + "getrandom 0.2.16", "libc", "untrusted", "windows-sys 0.52.0", @@ -1483,30 +1472,25 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.44" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ "bitflags", "errno", - "itoa", "libc", - "linux-raw-sys 0.4.15", - "once_cell", + "linux-raw-sys", "windows-sys 0.59.0", ] [[package]] -name = "rustix" -version = "1.0.5" +name = "rustix-linux-procfs" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056" dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys 0.9.3", - "windows-sys 0.59.0", + "once_cell", + "rustix", ] [[package]] @@ -1552,7 +1536,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -1577,9 +1561,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", @@ -1676,9 +1660,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.100" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -1694,37 +1678,17 @@ dependencies = [ "fastrand", "getrandom 0.3.2", "once_cell", - "rustix 1.0.5", + "rustix", "windows-sys 0.59.0", ] -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - [[package]] name = "thiserror" version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.12", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", + "thiserror-impl", ] [[package]] @@ -1735,7 +1699,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -1766,31 +1730,38 @@ checksum = "2d2e76690929402faae40aebdda620a2c0e25dd6d3b9afe48867dfd95991f4bd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.24" +version = "0.22.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", + "toml_write", "winnow", ] +[[package]] +name = "toml_write" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" + [[package]] name = "topological-sort" version = "0.2.2" @@ -1816,7 +1787,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -2036,9 +2007,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.4" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" +checksum = "d9fb597c990f03753e08d3c29efbfcf2019a003b4bf4ba19225c158e1549f0f3" dependencies = [ "memchr", ] @@ -2088,22 +2059,22 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.24" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.24" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -2123,7 +2094,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 07081dd..e1b7ce0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ resolver = "2" [workspace.package] version = "3.15.0" license = "GPL-3.0-only" -edition = "2021" +edition = "2024" repository = "https://github.com/chenxiaolong/avbroot" [workspace.lints.clippy] diff --git a/avbroot/Cargo.toml b/avbroot/Cargo.toml index a5003ad..15ba129 100644 --- a/avbroot/Cargo.toml +++ b/avbroot/Cargo.toml @@ -28,7 +28,7 @@ dlv-list = "0.6.0" flate2 = { version = "1.0.29", features = ["zlib-rs"] } gf256 = { version = "0.3.0", features = ["rs"] } hex = { version = "0.4.3", features = ["serde"] } -liblzma = "0.3.0" +liblzma = "0.4.1" lz4_flex = "0.11.1" memchr = "2.6.0" num-bigint-dig = "0.8.4" @@ -74,7 +74,7 @@ rustix = { version = "1.0.3", default-features = false, features = ["process"] } [build-dependencies] constcat = "0.6.0" prost-build = "0.13.1" -protox = "0.7.0" +protox = "0.8.0" [dev-dependencies] assert_matches = "1.5.0" diff --git a/avbroot/src/cli/ota.rs b/avbroot/src/cli/ota.rs index 3bb8b51..d1ea888 100644 --- a/avbroot/src/cli/ota.rs +++ b/avbroot/src/cli/ota.rs @@ -273,7 +273,7 @@ fn patch_system_image<'a>( }; if system_iter.next().is_some() { bail!("Multiple system partitions found"); - }; + } let _span = debug_span!("image", name = target).entered(); @@ -832,9 +832,7 @@ pub fn compress_image( partition.new_partition_info = Some(partition_info); partition.operations = operations; partition.estimate_cow_size = cow_estimate.map(|e| e.size); - let is_v3 = vabc_params - .map(|p| p.version == CowVersion::V3) - .unwrap_or_default(); + let is_v3 = vabc_params.is_some_and(|p| p.version == CowVersion::V3); partition.estimate_op_count_max = cow_estimate.and_then(|e| is_v3.then_some(e.num_ops)); *file = writer; @@ -866,7 +864,7 @@ fn recow_image( if partition.estimate_cow_size.is_none() { bail!("Partition has no original CoW estimate: {name}"); - }; + } let Some(vabc_params) = vabc_params else { bail!("Partition has CoW estimate, but VABC is disabled: {name}"); @@ -1508,7 +1506,7 @@ pub fn patch_subcommand(cli: &PatchCli, cancel_signal: &AtomicBool) -> Result<() ))); } else { assert!(cli.root.rootless); - }; + } if cli.skip_system_ota_cert { warn!("Not inserting OTA cert into system image; sideloading further updates may fail"); diff --git a/avbroot/src/crypto.rs b/avbroot/src/crypto.rs index 23de6ab..3d56c2d 100644 --- a/avbroot/src/crypto.rs +++ b/avbroot/src/crypto.rs @@ -144,6 +144,7 @@ pub enum PassphraseSource { impl PassphraseSource { pub fn new(key_file: &Path, pass_file: Option<&Path>, env_var: Option<&OsStr>) -> Self { + #[allow(clippy::option_if_let_else)] if let Some(v) = env_var { Self::EnvVar(v.to_owned()) } else if let Some(p) = pass_file { diff --git a/avbroot/src/format/bootimage.rs b/avbroot/src/format/bootimage.rs index 6fef298..9973f19 100644 --- a/avbroot/src/format/bootimage.rs +++ b/avbroot/src/format/bootimage.rs @@ -269,6 +269,7 @@ impl fmt::Display for BootImageV0Through2 { impl BootImageExt for BootImageV0Through2 { fn header_version(&self) -> u32 { + #[allow(clippy::bool_to_int_with_if)] if self.v2_extra.is_some() { 2 } else if self.v1_extra.is_some() { diff --git a/avbroot/src/format/lp.rs b/avbroot/src/format/lp.rs index 4471780..5cb7fcf 100644 --- a/avbroot/src/format/lp.rs +++ b/avbroot/src/format/lp.rs @@ -1640,7 +1640,7 @@ impl TryFrom<&RawMetadataSlot> for MetadataSlot { type Error = Error; fn try_from(raw_slot: &RawMetadataSlot) -> Result { - let mut slot = MetadataSlot { + let mut slot = Self { major_version: raw_slot.header.major_version.get(), minor_version: raw_slot.header.minor_version.get(), groups: Vec::with_capacity(raw_slot.groups.len()), @@ -1720,7 +1720,7 @@ impl TryFrom<&MetadataSlot> for RawMetadataSlot { fn try_from(slot: &MetadataSlot) -> Result { let header_size = RawHeader::size_for_version(slot.major_version, slot.minor_version); - let mut raw_slot = RawMetadataSlot { + let mut raw_slot = Self { header: RawHeader { magic: HEADER_MAGIC.into(), major_version: slot.major_version.into(), @@ -1937,7 +1937,7 @@ impl TryFrom<&Metadata> for RawMetadata { // We only do the bare minimum calculations needed here to fill out the // raw fields. There is no semantic validation. - let mut raw_metadata = RawMetadata { + let mut raw_metadata = Self { image_type: metadata.image_type, geometry: RawGeometry { magic: GEOMETRY_MAGIC.into(), diff --git a/avbroot/src/format/ota.rs b/avbroot/src/format/ota.rs index a3d9806..cc8bfa0 100644 --- a/avbroot/src/format/ota.rs +++ b/avbroot/src/format/ota.rs @@ -377,7 +377,7 @@ fn compute_property_files( } let remain = l - joined.len(); - joined.extend(iter::repeat(' ').take(remain)); + joined.extend(iter::repeat_n(' ', remain)); } Ok(joined) diff --git a/avbroot/src/format/payload.rs b/avbroot/src/format/payload.rs index 8bd76e9..250273e 100644 --- a/avbroot/src/format/payload.rs +++ b/avbroot/src/format/payload.rs @@ -1048,7 +1048,7 @@ struct ChunkingParams { } impl ChunkingParams { - fn chunk_size(&self, num_blocks: u64) -> u32 { + fn chunk_size(self, num_blocks: u64) -> u32 { match self.method { ChunkingMethod::Exact => self.block_size, ChunkingMethod::MaxPowerOf2(max_chunk_size) => { @@ -1165,9 +1165,7 @@ impl VabcAlgo { VabcAlgoKind::None => chunk_size as u64, VabcAlgoKind::Lz4 => lz4_flex::block::compress(chunk).len() as u64, VabcAlgoKind::Gz => { - let level = self - .level - .map_or(Compression::best(), |l| Compression::new(l.into())); + let level = self.level.map_or(Compression::best(), Compression::new); let mut encoder = GzEncoder::new(Vec::new(), level); encoder.write_all(chunk).map_err(Error::GzCompress)?; encoder.finish().map_err(Error::GzCompress)?.len() as u64 @@ -1208,7 +1206,7 @@ impl FromStr for VabcAlgo { type Err = InvalidVabcAlgo; fn from_str(s: &str) -> std::result::Result { - let (prefix, suffix) = s.split_once(",").unwrap_or((s, "")); + let (prefix, suffix) = s.split_once(',').unwrap_or((s, "")); // AOSP allows any algorithm to accept a level, even if it's unused. let level = if !suffix.is_empty() { @@ -1632,6 +1630,8 @@ pub fn compress_modified_image( writer.seek(SeekFrom::Start(operation.data_offset.unwrap()))?; writer.write_all(&data)?; + // Clippy doesn't know we're returning a Range. + #[allow(clippy::range_plus_one)] Ok(i..i + 1) }) .collect::>>() diff --git a/avbroot/src/format/sparse.rs b/avbroot/src/format/sparse.rs index db0abec..94a5946 100644 --- a/avbroot/src/format/sparse.rs +++ b/avbroot/src/format/sparse.rs @@ -159,7 +159,7 @@ impl RawHeader { return Err(Error::UnsupportedMajorVersion(self.major_version.get())); } - if self.file_hdr_sz.get() < mem::size_of::() as u16 { + if self.file_hdr_sz.get() < mem::size_of::() as u16 { return Err(Error::InvalidFileHeaderSize(self.file_hdr_sz.get())); } else if self.chunk_hdr_sz.get() < mem::size_of::() as u16 { return Err(Error::InvalidChunkHeaderSize(self.chunk_hdr_sz.get())); @@ -173,7 +173,7 @@ impl RawHeader { } fn excess_raw_header_bytes(&self) -> u16 { - self.file_hdr_sz.get() - mem::size_of::() as u16 + self.file_hdr_sz.get() - mem::size_of::() as u16 } fn excess_raw_chunk_bytes(&self) -> u16 { @@ -811,7 +811,7 @@ impl SparseReader { data = ChunkData::Crc32(expected.get()); } _ => unreachable!(), - }; + } let chunk = Chunk { bounds: ChunkBounds { diff --git a/avbroot/src/patch/boot.rs b/avbroot/src/patch/boot.rs index b1fa54d..d78fa81 100644 --- a/avbroot/src/patch/boot.rs +++ b/avbroot/src/patch/boot.rs @@ -432,7 +432,7 @@ impl BootImagePatch for MagiskRootPatcher { targets.push("init_boot"); } else if boot_images.contains_key("boot") { targets.push("boot"); - }; + } Ok(targets) } @@ -781,7 +781,7 @@ impl DsuPubKeyPatcher { e.data = data; } else { entries.push(CpioEntry::new_file(Self::AVBROOT_KEY_PATH, 0o644, data)); - }; + } *ramdisk = save_ramdisk(&entries, ramdisk_format, cancel_signal)?; @@ -971,7 +971,7 @@ impl BootImagePatch for PrepatchedImagePatcher { targets.push("init_boot"); } else if boot_images.contains_key("boot") { targets.push("boot"); - }; + } Ok(targets) } diff --git a/avbroot/src/protobuf.rs b/avbroot/src/protobuf.rs index 11d6e5b..939a2ec 100644 --- a/avbroot/src/protobuf.rs +++ b/avbroot/src/protobuf.rs @@ -1,3 +1,4 @@ +#![allow(clippy::all)] #![allow(clippy::nursery)] #![allow(clippy::pedantic)] diff --git a/e2e/src/main.rs b/e2e/src/main.rs index 338beb6..c9de297 100644 --- a/e2e/src/main.rs +++ b/e2e/src/main.rs @@ -97,7 +97,7 @@ fn verify_hash(path: &Path, sha256: &[u8; 32], cancel_signal: &AtomicBool) -> Re fn append_avb( file: &mut PSeekFile, name: &str, - avb: &Avb, + avb: Avb, hash_tree: bool, ota_info: &OtaInfo, key_avb: &RsaSigningKey, @@ -295,7 +295,7 @@ fn create_ramdisk( fn create_boot_image( file: &mut PSeekFile, name: &str, - avb: &Avb, + avb: Avb, boot_data: &BootData, ota_info: &OtaInfo, key_avb: &RsaSigningKey, @@ -422,8 +422,8 @@ fn create_boot_image( fn create_dm_verity_image( file: &mut PSeekFile, name: &str, - avb: &Avb, - dm_verity_data: &DmVerityData, + avb: Avb, + dm_verity_data: DmVerityData, ota_info: &OtaInfo, key_avb: &RsaSigningKey, cert_ota: &Certificate, @@ -451,7 +451,7 @@ fn create_dm_verity_image( fn create_vbmeta_image( file: &mut PSeekFile, name: &str, - avb: &Avb, + avb: Avb, vbmeta_data: &VbmetaData, inputs: &BTreeMap, key: &RsaSigningKey, @@ -537,7 +537,7 @@ fn create_partition_images( create_boot_image( &mut file, name, - &partition.avb, + partition.avb, data, ota_info, key_avb, @@ -550,8 +550,8 @@ fn create_partition_images( create_dm_verity_image( &mut file, name, - &partition.avb, - data, + partition.avb, + *data, ota_info, key_avb, cert_ota, @@ -560,7 +560,7 @@ fn create_partition_images( .with_context(|| format!("Failed to create dm-verity image: {name}"))?; } Data::Vbmeta(data) => { - create_vbmeta_image(&mut file, name, &partition.avb, data, &files, key_avb) + create_vbmeta_image(&mut file, name, partition.avb, data, &files, key_avb) .with_context(|| format!("Failed to create vbmeta image: {name}"))?; } } @@ -611,10 +611,7 @@ fn create_payload( compressed.insert(name, writer); - let is_v3 = profile - .vabc - .map(|e| e.version == CowVersion::V3) - .unwrap_or_default(); + let is_v3 = profile.vabc.is_some_and(|e| e.version == CowVersion::V3); payload_partitions.push(PartitionUpdate { partition_name: name.clone(), @@ -1205,6 +1202,7 @@ fn test_subcommand(cli: &TestCli, cancel_signal: &AtomicBool) -> Result<()> { Some(_) => None, None => Some(TempDir::new().context("Failed to create temp directory")?), }; + #[allow(clippy::option_if_let_else)] let work_dir = match &cli.config.work_dir { Some(w) => w.as_path(), None => work_temp_dir.as_ref().unwrap().path(), @@ -1340,7 +1338,7 @@ fn helper_mode() -> Result<()> { let cli = HelperCli::parse(); let private_key_path = { - let parent = cli.public_key.parent().unwrap_or(Path::new(".")); + let parent = cli.public_key.parent().unwrap_or_else(|| Path::new(".")); let name = cli .public_key .file_name() @@ -1414,7 +1412,10 @@ fn main() -> Result<()> { if env::var_os(ENV_HELPER_MODE).is_some() { return helper_mode(); } - env::set_var(ENV_HELPER_MODE, "true"); + // SAFETY: No multithreading at this point. + unsafe { + env::set_var(ENV_HELPER_MODE, "true"); + } // Set up a cancel signal so we can properly clean up any temporary files. let cancel_signal = Arc::new(AtomicBool::new(false)); diff --git a/xtask/src/changelog.rs b/xtask/src/changelog.rs index b7701c1..66b02f6 100644 --- a/xtask/src/changelog.rs +++ b/xtask/src/changelog.rs @@ -1,9 +1,9 @@ -// SPDX-FileCopyrightText: 2023 Andrew Gunnerson +// SPDX-FileCopyrightText: 2023-2025 Andrew Gunnerson // SPDX-License-Identifier: GPL-3.0-only use std::{ collections::BTreeMap, - fmt, + fmt::{self, Write as _}, fs::{self, File}, io::{BufRead, BufReader}, path::Path, @@ -108,7 +108,7 @@ fn update_changelog_links(path: &Path, base_url: &str) -> Result<()> { } for (link_ref, link) in links { - result.push_str(&format!("{link_ref}: {link}\n")); + let _ = writeln!(result, "{link_ref}: {link}"); } fs::write(path, result)?;