Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package blake3 for openSUSE:Factory checked in at 2026-08-11 17:09:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/blake3 (Old) and /work/SRC/openSUSE:Factory/.blake3.new.17972 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "blake3" Tue Aug 11 17:09:19 2026 rev:6 rq:1370282 version:1.8.6 Changes: -------- --- /work/SRC/openSUSE:Factory/blake3/blake3.changes 2026-04-28 16:10:02.632155851 +0200 +++ /work/SRC/openSUSE:Factory/.blake3.new.17972/blake3.changes 2026-08-11 17:09:22.450315471 +0200 @@ -1,0 +2,13 @@ +Fri Aug 7 20:10:28 UTC 2026 - Eyad Issa <[email protected]> + +- Update to version 1.8.6: + * Use seek rather than metadata to get the length of files and + mappings in update_mmap and update_mmap_rayon, and tolerate + mmap failures. This allows b3sum to memory-map Linux block + devices and makes hashing NUL files on Windows work without + --no-mmap or <. +- Update to version 1.8.5: + * Forcibly disable LTO when compiling C intrinsics from the Rust + build, fixing a build failure on Arch Linux ARM. + +------------------------------------------------------------------- Old: ---- blake3-1.8.4.tar.gz New: ---- blake3-1.8.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ blake3.spec ++++++ --- /var/tmp/diff_new_pack.0MNpt2/_old 2026-08-11 17:09:24.750412960 +0200 +++ /var/tmp/diff_new_pack.0MNpt2/_new 2026-08-11 17:09:24.754413130 +0200 @@ -30,7 +30,7 @@ %bcond_with b3sum Name: blake3 -Version: 1.8.4 +Version: 1.8.6 Release: 0 Summary: A cryptographic hash function License: Apache-2.0 ++++++ blake3-1.8.4.tar.gz -> blake3-1.8.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/.github/workflows/ci.yml new/BLAKE3-1.8.6/.github/workflows/ci.yml --- old/BLAKE3-1.8.4/.github/workflows/ci.yml 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/.github/workflows/ci.yml 2026-08-06 00:26:34.000000000 +0200 @@ -20,10 +20,11 @@ fail-fast: false matrix: target: [ - { "os": "ubuntu-latest", "toolchain": "x86_64-unknown-linux-gnu", "name": "Linux GNU" }, - { "os": "macOS-latest", "toolchain": "aarch64-apple-darwin", "name": "macOS" }, - { "os": "windows-latest", "toolchain": "x86_64-pc-windows-msvc", "name": "Windows MSVC" }, - { "os": "windows-latest", "toolchain": "x86_64-pc-windows-gnu", "name": "Windows GNU" } + { "os": "ubuntu-latest", "toolchain": "x86_64-unknown-linux-gnu", "name": "Linux GNU" }, + { "os": "ubuntu-24.04-arm", "toolchain": "aarch64-unknown-linux-gnu", "name": "Linux GNU (arm64)" }, + { "os": "macOS-latest", "toolchain": "aarch64-apple-darwin", "name": "macOS" }, + { "os": "windows-latest", "toolchain": "x86_64-pc-windows-msvc", "name": "Windows MSVC" }, + { "os": "windows-latest", "toolchain": "x86_64-pc-windows-gnu", "name": "Windows GNU" } ] channel: ["stable", "beta", "nightly"] @@ -53,6 +54,11 @@ - run: cargo test --features=mmap,rayon,traits-preview,serde,zeroize # no_std tests. - run: cargo test --no-default-features + - name: Make sure enabling LTO via CFLAGS doesn't break the build. + run: cargo build --tests --features prefer_intrinsics + if: matrix.target.toolchain != 'x86_64-pc-windows-msvc' + env: + CFLAGS: -flto # A matrix of different test settings: # - debug vs release @@ -165,10 +171,11 @@ fail-fast: false matrix: target: [ - { "os": "ubuntu-latest", "toolchain": "x86_64-unknown-linux-gnu", "name": "Linux GNU" }, - { "os": "macOS-latest", "toolchain": "aarch64-apple-darwin", "name": "macOS" }, - { "os": "windows-latest", "toolchain": "x86_64-pc-windows-msvc", "name": "Windows MSVC" }, - { "os": "windows-latest", "toolchain": "x86_64-pc-windows-gnu", "name": "Windows GNU" } + { "os": "ubuntu-latest", "toolchain": "x86_64-unknown-linux-gnu", "name": "Linux GNU" }, + { "os": "ubuntu-24.04-arm", "toolchain": "aarch64-unknown-linux-gnu", "name": "Linux GNU (arm64)" }, + { "os": "macOS-latest", "toolchain": "aarch64-apple-darwin", "name": "macOS" }, + { "os": "windows-latest", "toolchain": "x86_64-pc-windows-msvc", "name": "Windows MSVC" }, + { "os": "windows-latest", "toolchain": "x86_64-pc-windows-gnu", "name": "Windows GNU" } ] channel: ["stable", "beta", "nightly"] @@ -184,6 +191,12 @@ - name: test b3sum --no-default-features run: cargo test --no-default-features working-directory: ./b3sum + - name: Make sure enabling LTO via CFLAGS doesn't break the build. + run: cargo build --features prefer_intrinsics + if: matrix.target.toolchain != 'x86_64-pc-windows-msvc' + env: + CFLAGS: -flto + working-directory: ./b3sum cross_tests: name: cross ${{ matrix.arch }} @@ -431,7 +444,7 @@ sudo apt-get install libtbb-dev libtbb12 - name: CMake generation, build, install run: | - ${{ matrix.os != 'windows-latest' || '& "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/Tools/Launch-VsDevShell.ps1" -Arch amd64 -SkipAutomaticLocation' }} + ${{ matrix.os != 'windows-latest' || '$vs_install_path = & "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath; & "$vs_install_path/Common7/Tools/Launch-VsDevShell.ps1" -Arch amd64 -SkipAutomaticLocation' }} cmake -S c -B c/build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/target -DCMAKE_C_COMPILER=${{ matrix.toolchain.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.toolchain.cxx }} -DBLAKE3_USE_TBB=${{ matrix.use_tbb }} -DBLAKE3_FETCH_TBB=${{ matrix.os == 'windows-latest' && 'YES' || 'NO' }} -DBLAKE3_EXAMPLES=ON cmake --build c/build --target install diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/Cargo.toml new/BLAKE3-1.8.6/Cargo.toml --- old/BLAKE3-1.8.4/Cargo.toml 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/Cargo.toml 2026-08-06 00:26:34.000000000 +0200 @@ -1,6 +1,6 @@ [package] name = "blake3" -version = "1.8.4" +version = "1.8.6" authors = ["Jack O'Connor <[email protected]>", "Samuel Neves"] description = "the BLAKE3 hash function" repository = "https://github.com/BLAKE3-team/BLAKE3" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/b3sum/Cargo.lock new/BLAKE3-1.8.6/b3sum/Cargo.lock --- old/BLAKE3-1.8.4/b3sum/Cargo.lock 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/b3sum/Cargo.lock 2026-08-06 00:26:34.000000000 +0200 @@ -54,9 +54,9 @@ [[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 = "arrayref" @@ -66,13 +66,13 @@ [[package]] name = "arrayvec" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" [[package]] name = "b3sum" -version = "1.8.4" +version = "1.8.6" dependencies = [ "anyhow", "blake3", @@ -86,13 +86,13 @@ [[package]] name = "bitflags" -version = "2.11.0" +version = "2.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" +checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" [[package]] name = "blake3" -version = "1.8.4" +version = "1.8.6" dependencies = [ "arrayref", "arrayvec", @@ -106,9 +106,9 @@ [[package]] name = "cc" -version = "1.2.58" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1" +checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9" dependencies = [ "find-msvc-tools", "shlex", @@ -122,9 +122,9 @@ [[package]] name = "clap" -version = "4.6.0" +version = "4.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351" +checksum = "301b56658598e48f3648647ac6fc887be7e7108eddfa4e9b63fcf3ec58c0cadf" dependencies = [ "clap_builder", "clap_derive", @@ -132,9 +132,9 @@ [[package]] name = "clap_builder" -version = "4.6.0" +version = "4.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +checksum = "94a65403d1a1bd28f7dc68eb8506e8874808ee5eecb59298de588e2e1407a078" dependencies = [ "anstream", "anstyle", @@ -145,9 +145,9 @@ [[package]] name = "clap_derive" -version = "4.6.0" +version = "4.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1110bd8a634a1ab8cb04345d8d878267d57c3cf1b38d91b71af6686408bbca6a" +checksum = "d012d2b9d65aca7f18f4d9878a045bc17899bba951561ba5ec3c2ba1eed9a061" dependencies = [ "heck", "proc-macro2", @@ -184,9 +184,9 @@ [[package]] name = "crossbeam-deque" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -194,18 +194,18 @@ [[package]] name = "crossbeam-epoch" -version = "0.9.18" +version = "0.9.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" [[package]] name = "duct" @@ -220,12 +220,6 @@ ] [[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] name = "errno" version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -237,9 +231,9 @@ [[package]] name = "fastrand" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" [[package]] name = "find-msvc-tools" @@ -248,44 +242,21 @@ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[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 = "glob" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" - -[[package]] -name = "hashbrown" -version = "0.15.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "foldhash", -] - -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" [[package]] name = "heck" @@ -300,46 +271,16 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "id-arena" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" - -[[package]] -name = "indexmap" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" -dependencies = [ - "equivalent", - "hashbrown 0.16.1", - "serde", - "serde_core", -] - -[[package]] name = "is_terminal_polyfill" version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] -name = "itoa" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" - -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - -[[package]] name = "libc" -version = "0.2.183" +version = "0.2.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" [[package]] name = "linux-raw-sys" @@ -348,22 +289,10 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] -name = "log" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" - -[[package]] -name = "memchr" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" - -[[package]] name = "memmap2" -version = "0.9.10" +version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3" +checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" dependencies = [ "libc", ] @@ -391,29 +320,19 @@ ] [[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", ] [[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", ] @@ -448,54 +367,6 @@ ] [[package]] -name = "semver" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -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 = "shared_child" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -514,9 +385,9 @@ [[package]] name = "shlex" -version = "1.3.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" [[package]] name = "sigchld" @@ -557,9 +428,9 @@ [[package]] name = "syn" -version = "2.0.117" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" dependencies = [ "proc-macro2", "quote", @@ -596,70 +467,12 @@ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - -[[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] -name = "wasip2" -version = "1.0.2+wasi-0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" -dependencies = [ - "wit-bindgen", -] - -[[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", -] - -[[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 = "wild" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -756,97 +569,3 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" - -[[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-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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/b3sum/Cargo.toml new/BLAKE3-1.8.6/b3sum/Cargo.toml --- old/BLAKE3-1.8.4/b3sum/Cargo.toml 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/b3sum/Cargo.toml 2026-08-06 00:26:34.000000000 +0200 @@ -1,6 +1,6 @@ [package] name = "b3sum" -version = "1.8.4" +version = "1.8.6" authors = ["Jack O'Connor <[email protected]>"] description = "a command line implementation of the BLAKE3 hash function" repository = "https://github.com/BLAKE3-team/BLAKE3" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/b3sum/tests/cli_tests.rs new/BLAKE3-1.8.6/b3sum/tests/cli_tests.rs --- old/BLAKE3-1.8.4/b3sum/tests/cli_tests.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/b3sum/tests/cli_tests.rs 2026-08-06 00:26:34.000000000 +0200 @@ -216,6 +216,18 @@ } #[test] +#[cfg(windows)] +fn test_null_device_on_windows() { + let expected = blake3::hash(b"").to_hex(); + let output = cmd!(b3sum_exe(), "--no-names", "NUL").read().unwrap(); + assert_eq!(&*expected, output); + let output = cmd!(b3sum_exe(), "--no-names", "--no-mmap", "NUL") + .read() + .unwrap(); + assert_eq!(&*expected, output); +} + +#[test] fn test_length_without_value_is_an_error() { let result = cmd!(b3sum_exe(), "--length") .stdin_bytes("foo") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/benches/bench.rs new/BLAKE3-1.8.6/benches/bench.rs --- old/BLAKE3-1.8.4/benches/bench.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/benches/bench.rs 2026-08-06 00:26:34.000000000 +0200 @@ -4,8 +4,8 @@ use arrayref::array_ref; use arrayvec::ArrayVec; -use blake3::platform::{Platform, MAX_SIMD_DEGREE}; use blake3::OUT_LEN; +use blake3::platform::{MAX_SIMD_DEGREE, Platform}; use blake3::{BLOCK_LEN, CHUNK_LEN}; use rand::prelude::*; use test::Bencher; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/build.rs new/BLAKE3-1.8.6/build.rs --- old/BLAKE3-1.8.4/build.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/build.rs 2026-08-06 00:26:34.000000000 +0200 @@ -1,7 +1,7 @@ use std::env; fn defined(var: &str) -> bool { - println!("cargo:rerun-if-env-changed={}", var); + println!("cargo::rerun-if-env-changed={}", var); env::var_os(var).is_some() } @@ -31,9 +31,9 @@ fn warn(warning: &str) { assert!(!warning.contains("\n")); - println!("cargo:warning={}", warning); + println!("cargo::warning={}", warning); if is_ci() { - println!("cargo:warning=Warnings in CI are treated as errors. Build failed."); + println!("cargo::warning=Warnings in CI are treated as errors. Build failed."); std::process::exit(1); } } @@ -198,18 +198,18 @@ // No C code to compile here. Set the cfg flags that enable the Rust SSE2, // SSE4.1, and AVX2 intrinsics modules. The regular Cargo build will compile // them. - println!("cargo:rustc-cfg=blake3_sse2_rust"); - println!("cargo:rustc-cfg=blake3_sse41_rust"); - println!("cargo:rustc-cfg=blake3_avx2_rust"); + println!("cargo::rustc-cfg=blake3_sse2_rust"); + println!("cargo::rustc-cfg=blake3_sse41_rust"); + println!("cargo::rustc-cfg=blake3_avx2_rust"); } fn build_sse2_sse41_avx2_assembly() { // Build the assembly implementations for SSE4.1 and AVX2. This is // preferred, but it only supports x86_64. assert!(is_x86_64()); - println!("cargo:rustc-cfg=blake3_sse2_ffi"); - println!("cargo:rustc-cfg=blake3_sse41_ffi"); - println!("cargo:rustc-cfg=blake3_avx2_ffi"); + println!("cargo::rustc-cfg=blake3_sse2_ffi"); + println!("cargo::rustc-cfg=blake3_sse41_ffi"); + println!("cargo::rustc-cfg=blake3_avx2_ffi"); let mut build = new_build(); if is_windows_target() { if use_msvc_asm() { @@ -235,7 +235,7 @@ fn build_avx512_c_intrinsics() { // This is required on 32-bit x86 targets, since the assembly // implementation doesn't support those. - println!("cargo:rustc-cfg=blake3_avx512_ffi"); + println!("cargo::rustc-cfg=blake3_avx512_ffi"); let mut build = new_build(); build.file("c/blake3_avx512.c"); if is_windows_msvc() { @@ -255,7 +255,7 @@ // Build the assembly implementation for AVX-512. This is preferred, but it // only supports x86_64. assert!(is_x86_64()); - println!("cargo:rustc-cfg=blake3_avx512_ffi"); + println!("cargo::rustc-cfg=blake3_avx512_ffi"); let mut build = new_build(); let mut is_msvc = false; if is_windows_target() { @@ -297,10 +297,24 @@ assert!(is_wasm32()); // No C code to compile here. Set the cfg flags that enable the Wasm SIMD. // The regular Cargo build will compile it. - println!("cargo:rustc-cfg=blake3_wasm32_simd"); + println!("cargo::rustc-cfg=blake3_wasm32_simd"); } fn main() -> Result<(), Box<dyn std::error::Error>> { + // If CFLAGS is set, make sure LTO is disabled by appending -fno-lto. (We can't do this with + // .flag() later on, because CFLAGS takes precedence.) Any mismatch between the C compiler and + // the Rust linker can cause linker errors in our C intrinsics implementations if LTO is + // enabled. See https://github.com/BLAKE3-team/BLAKE3/issues/550. + if !is_windows_msvc() { + if let Some(mut flags) = env::var_os("CFLAGS") { + flags.push(" -fno-lto"); + // SAFETY: This build script is single-threaded. + unsafe { + env::set_var("CFLAGS", flags); + } + } + } + // As of Rust 1.80, unrecognized config names are warnings. Give Cargo all of our config names. let all_cfgs = [ "blake3_sse2_ffi", @@ -314,9 +328,8 @@ "blake3_wasm32_simd", ]; for cfg_name in all_cfgs { - // TODO: Switch this whole file to the new :: syntax when our MSRV reaches 1.77. // https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script - println!("cargo:rustc-check-cfg=cfg({cfg_name}, values(none()))"); + println!("cargo::rustc-check-cfg=cfg({cfg_name}, values(none()))"); } if is_pure() && is_neon() { @@ -353,7 +366,7 @@ if (is_arm() && is_neon()) || (!is_no_neon() && !is_pure() && is_aarch64() && is_little_endian()) { - println!("cargo:rustc-cfg=blake3_neon"); + println!("cargo::rustc-cfg=blake3_neon"); build_neon_c_intrinsics(); } @@ -365,13 +378,13 @@ // environment variables it supports, in particular for $CC. We expect to // do a lot of benchmarking across different compilers, so we explicitly // add the variables that we're likely to need. - println!("cargo:rerun-if-env-changed=CC"); - println!("cargo:rerun-if-env-changed=CFLAGS"); + println!("cargo::rerun-if-env-changed=CC"); + println!("cargo::rerun-if-env-changed=CFLAGS"); // Ditto for source files, though these shouldn't change as often. for file in std::fs::read_dir("c")? { println!( - "cargo:rerun-if-changed={}", + "cargo::rerun-if-changed={}", file?.path().to_str().expect("utf-8") ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/c/CMakeLists.txt new/BLAKE3-1.8.6/c/CMakeLists.txt --- old/BLAKE3-1.8.4/c/CMakeLists.txt 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/c/CMakeLists.txt 2026-08-06 00:26:34.000000000 +0200 @@ -10,7 +10,7 @@ endif() project(libblake3 - VERSION 1.8.4 + VERSION 1.8.6 DESCRIPTION "BLAKE3 C implementation" LANGUAGES C CXX ASM ) @@ -31,13 +31,20 @@ set(BLAKE3_AMD64_NAMES amd64 AMD64 x86_64) set(BLAKE3_X86_NAMES i686 x86 X86) set(BLAKE3_ARMv8_NAMES aarch64 AArch64 arm64 ARM64 armv8 armv8a) -# default SIMD compiler flag configuration (can be overriden by toolchains or CLI) +# default SIMD compiler flag configuration (can be overridden by toolchains or CLI) if(MSVC) - set(BLAKE3_CFLAGS_SSE2 "/arch:SSE2" CACHE STRING "the compiler flags to enable SSE2") - # MSVC has no dedicated sse4.1 flag (see https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86?view=msvc-170) - set(BLAKE3_CFLAGS_SSE4.1 "/arch:AVX" CACHE STRING "the compiler flags to enable SSE4.1") - set(BLAKE3_CFLAGS_AVX2 "/arch:AVX2" CACHE STRING "the compiler flags to enable AVX2") - set(BLAKE3_CFLAGS_AVX512 "/arch:AVX512" CACHE STRING "the compiler flags to enable AVX512") + if (CMAKE_C_COMPILER_ID STREQUAL "Clang") + set(BLAKE3_CFLAGS_SSE2 "-msse2" CACHE STRING "the compiler flags to enable SSE2") + set(BLAKE3_CFLAGS_SSE4.1 "-msse4.1" CACHE STRING "the compiler flags to enable SSE4.1") + set(BLAKE3_CFLAGS_AVX2 "-mavx2" CACHE STRING "the compiler flags to enable AVX2") + set(BLAKE3_CFLAGS_AVX512 "-mavx512f -mavx512vl" CACHE STRING "the compiler flags to enable AVX512") + else() + set(BLAKE3_CFLAGS_SSE2 "/arch:SSE2" CACHE STRING "the compiler flags to enable SSE2") + # MSVC has no dedicated sse4.1 flag (see https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86?view=msvc-170) + set(BLAKE3_CFLAGS_SSE4.1 "/arch:AVX" CACHE STRING "the compiler flags to enable SSE4.1") + set(BLAKE3_CFLAGS_AVX2 "/arch:AVX2" CACHE STRING "the compiler flags to enable AVX2") + set(BLAKE3_CFLAGS_AVX512 "/arch:AVX512" CACHE STRING "the compiler flags to enable AVX512") + endif() set(BLAKE3_AMD64_ASM_SOURCES blake3_avx2_x86-64_windows_msvc.asm @@ -333,7 +340,7 @@ set(${joined_path} "${temp_path}" PARENT_SCOPE) endfunction() -# In-place rewrite a string and and join by `sep`. +# In-place rewrite a string and join by `sep`. # # TODO: Replace function with list(JOIN) when updating to CMake 3.12 function(join_pkg_config_field sep requires) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/c/blake3.h new/BLAKE3-1.8.6/c/blake3.h --- old/BLAKE3-1.8.4/c/blake3.h 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/c/blake3.h 2026-08-06 00:26:34.000000000 +0200 @@ -30,7 +30,7 @@ extern "C" { #endif -#define BLAKE3_VERSION_STRING "1.8.4" +#define BLAKE3_VERSION_STRING "1.8.6" #define BLAKE3_KEY_LEN 32 #define BLAKE3_OUT_LEN 32 #define BLAKE3_BLOCK_LEN 64 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/c/blake3_c_rust_bindings/build.rs new/BLAKE3-1.8.6/c/blake3_c_rust_bindings/build.rs --- old/BLAKE3-1.8.4/c/blake3_c_rust_bindings/build.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/c/blake3_c_rust_bindings/build.rs 2026-08-06 00:26:34.000000000 +0200 @@ -227,8 +227,8 @@ // environment variables it supports, in particular for $CC. We expect to // do a lot of benchmarking across different compilers, so we explicitly // add the variables that we're likely to need. - println!("cargo:rerun-if-env-changed=CC"); - println!("cargo:rerun-if-env-changed=CFLAGS"); + println!("cargo::rerun-if-env-changed=CC"); + println!("cargo::rerun-if-env-changed=CFLAGS"); // Ditto for source files, though these shouldn't change as often. `ignore::Walk` respects // .gitignore, so this doesn't traverse target/. @@ -236,7 +236,7 @@ let result = result?; let path = result.path(); if path.is_file() { - println!("cargo:rerun-if-changed={}", path.to_str().unwrap()); + println!("cargo::rerun-if-changed={}", path.to_str().unwrap()); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/c/blake3_c_rust_bindings/src/lib.rs new/BLAKE3-1.8.6/c/blake3_c_rust_bindings/src/lib.rs --- old/BLAKE3-1.8.4/c/blake3_c_rust_bindings/src/lib.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/c/blake3_c_rust_bindings/src/lib.rs 2026-08-06 00:26:34.000000000 +0200 @@ -3,7 +3,7 @@ //! repo, these bindings are not expected to be used in production. They're //! intended for testing and benchmarking. -use std::ffi::{c_void, CString}; +use std::ffi::{CString, c_void}; use std::mem::MaybeUninit; #[cfg(test)] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/ffi_avx2.rs new/BLAKE3-1.8.6/src/ffi_avx2.rs --- old/BLAKE3-1.8.4/src/ffi_avx2.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/ffi_avx2.rs 2026-08-06 00:26:34.000000000 +0200 @@ -1,4 +1,4 @@ -use crate::{CVWords, IncrementCounter, BLOCK_LEN, OUT_LEN}; +use crate::{BLOCK_LEN, CVWords, IncrementCounter, OUT_LEN}; // Note that there is no AVX2 implementation of compress_in_place or // compress_xof. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/ffi_avx512.rs new/BLAKE3-1.8.6/src/ffi_avx512.rs --- old/BLAKE3-1.8.4/src/ffi_avx512.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/ffi_avx512.rs 2026-08-06 00:26:34.000000000 +0200 @@ -1,4 +1,4 @@ -use crate::{CVWords, IncrementCounter, BLOCK_LEN, OUT_LEN}; +use crate::{BLOCK_LEN, CVWords, IncrementCounter, OUT_LEN}; // Unsafe because this may only be called on platforms supporting AVX-512. pub unsafe fn compress_in_place( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/ffi_neon.rs new/BLAKE3-1.8.6/src/ffi_neon.rs --- old/BLAKE3-1.8.4/src/ffi_neon.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/ffi_neon.rs 2026-08-06 00:26:34.000000000 +0200 @@ -1,4 +1,4 @@ -use crate::{CVWords, IncrementCounter, BLOCK_LEN, OUT_LEN}; +use crate::{BLOCK_LEN, CVWords, IncrementCounter, OUT_LEN}; // Unsafe because this may only be called on platforms supporting NEON. pub unsafe fn hash_many<const N: usize>( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/ffi_sse2.rs new/BLAKE3-1.8.6/src/ffi_sse2.rs --- old/BLAKE3-1.8.4/src/ffi_sse2.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/ffi_sse2.rs 2026-08-06 00:26:34.000000000 +0200 @@ -1,4 +1,4 @@ -use crate::{CVWords, IncrementCounter, BLOCK_LEN, OUT_LEN}; +use crate::{BLOCK_LEN, CVWords, IncrementCounter, OUT_LEN}; // Unsafe because this may only be called on platforms supporting SSE2. pub unsafe fn compress_in_place( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/ffi_sse41.rs new/BLAKE3-1.8.6/src/ffi_sse41.rs --- old/BLAKE3-1.8.4/src/ffi_sse41.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/ffi_sse41.rs 2026-08-06 00:26:34.000000000 +0200 @@ -1,4 +1,4 @@ -use crate::{CVWords, IncrementCounter, BLOCK_LEN, OUT_LEN}; +use crate::{BLOCK_LEN, CVWords, IncrementCounter, OUT_LEN}; // Unsafe because this may only be called on platforms supporting SSE4.1. pub unsafe fn compress_in_place( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/hazmat.rs new/BLAKE3-1.8.6/src/hazmat.rs --- old/BLAKE3-1.8.4/src/hazmat.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/hazmat.rs 2026-08-06 00:26:34.000000000 +0200 @@ -150,7 +150,7 @@ //! of the same input. use crate::platform::Platform; -use crate::{CVWords, Hasher, CHUNK_LEN, IV, KEY_LEN, OUT_LEN}; +use crate::{CHUNK_LEN, CVWords, Hasher, IV, KEY_LEN, OUT_LEN}; /// Extension methods for [`Hasher`]. This is the main entrypoint to the `hazmat` module. pub trait HasherExt { @@ -397,15 +397,16 @@ /// See the [module level examples](index.html#examples). #[derive(Copy, Clone, Debug)] pub enum Mode<'a> { - /// Corresponding to [`hash`](crate::hash) + /// The default [`hash`][crate::hash] mode. Subtrees must be hashed with [`Hasher::new`]. Hash, - /// Corresponding to [`keyed_hash`](crate::hash) + /// The [`keyed_hash`][crate::keyed_hash] mode. Subtrees must be hashed with + /// [`Hasher::new_keyed`]. KeyedHash(&'a [u8; KEY_LEN]), - /// Corresponding to [`derive_key`](crate::hash) - /// - /// The [`ContextKey`] comes from [`hash_derive_key_context`]. + /// The [`derive_key`][crate::derive_key] mode. Subtrees must be hashed with either + /// [`Hasher::new_derive_key`] or [`Hasher::new_from_context_key`]. The [`ContextKey`] comes + /// from [`hash_derive_key_context`]. DeriveKeyMaterial(&'a ContextKey), } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/io.rs new/BLAKE3-1.8.6/src/io.rs --- old/BLAKE3-1.8.4/src/io.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/io.rs 2026-08-06 00:26:34.000000000 +0200 @@ -1,10 +1,13 @@ //! Helper functions for efficient IO. -#[cfg(feature = "std")] -pub(crate) fn copy_wide( - mut reader: impl std::io::Read, - hasher: &mut crate::Hasher, -) -> std::io::Result<u64> { +#[cfg(feature = "mmap")] +use std::fs::File; +use std::io; + +#[cfg(feature = "mmap")] +const MINIMUM_MMAP_SIZE: u64 = 16 * 1024; // 16 KiB + +pub(crate) fn copy_wide(mut reader: impl io::Read, hasher: &mut crate::Hasher) -> io::Result<u64> { let mut buffer = [0; 65536]; let mut total = 0; loop { @@ -15,15 +18,23 @@ total += n as u64; } // see test_update_reader_interrupted - Err(e) if e.kind() == std::io::ErrorKind::Interrupted => continue, + Err(e) if e.kind() == io::ErrorKind::Interrupted => continue, Err(e) => return Err(e), } } } -// Mmap a file, if it looks like a good idea. Return None in cases where we know mmap will fail, or -// if the file is short enough that mmapping isn't worth it. However, if we do try to mmap and it -// fails, return the error. +// Try to `mmap` a file, unless it's short enough that ordinary reads are faster, currently 16 KiB. +// Return `Ok(None)` if mapping fails or if we don't attempt it. Only return `Err` for unexpected +// failures that could leave the `File` in a bad state. +// +// We seek to (near) end-of-file to get the length, and the prior cursor position is ignored. If +// mapping fails, we [`rewind`] the file cursor to start-of-file before returning `None`. We don't +// `rewind` if the mapping succeeds, however, to avoid unnecessary syscalls. In the unlikely event +// that the caller wants to do ordinary reads in addition to mapped reads, they need to `rewind` +// explicitly in that case. (This function isn't public, but that comes up in test cases.) +// +// [`rewind`]: https://doc.rust-lang.org/std/io/trait.Seek.html#method.rewind // // SAFETY: Mmaps are fundamentally unsafe, because you can call invariant-checking functions like // str::from_utf8 on them and then have them change out from under you. Letting a safe caller get @@ -47,18 +58,151 @@ // But if you "know what you're doing," I don't think *const i32 and &i32 are fundamentally // different here. Feedback needed. #[cfg(feature = "mmap")] -pub(crate) fn maybe_mmap_file(file: &std::fs::File) -> std::io::Result<Option<memmap2::Mmap>> { - let metadata = file.metadata()?; - let file_size = metadata.len(); - if !metadata.is_file() { - // Not a real file. - Ok(None) - } else if file_size < 16 * 1024 { - // Mapping small files is not worth it, and some special files that can't be mapped report - // a size of zero. - Ok(None) - } else { - let map = unsafe { memmap2::Mmap::map(file)? }; - Ok(Some(map)) +pub(crate) fn maybe_mmap_file(file: &mut File) -> io::Result<Option<memmap2::Mmap>> { + // Seeking is more reliable than `.metadata()` for getting the length. Either is valid for + // regular files, but block devices sometimes report zero length despite being mappable. See + // https://github.com/BLAKE3-team/BLAKE3/pull/487. + use io::Seek; + // In debug mode only, check that the cursor is at the beginning. If the seek below fails, + // we'll leave the cursor where it is, and that can be confusing if it isn't at the beginning. + // (This function isn't public, but this comes up in test cases.) + if cfg!(debug_assertions) { + if let Ok(position) = file.stream_position() { + assert_eq!(position, 0, "initial file offset isn't at the beginning"); + } + } + // Seek to "16 KiB less 1 byte" from end-of-file. For short files, this will generally fail + // with an invalid argument error and leave the cursor at the beginning. For a regular file of + // exactly 16383 bytes, it will succeed and return 0, again leaving the cursor at the + // beginning. For some special/device files like /dev/random, it will also return 0. In all + // those cases, we can return without doing any extra syscalls to reset the cursor, and let the + // caller fall back to ordinary reads. + let seek_offset = MINIMUM_MMAP_SIZE - 1; + let seek_target = io::SeekFrom::End(-(seek_offset as i64)); + let Ok(offset_len) = file.seek(seek_target) else { + return Ok(None); // short or unseekable files + }; + if offset_len == 0 { + return Ok(None); // either exactly 16383 bytes, or e.g. /dev/random + } + // It's UB to produce a slice longer than `isize::MAX`. `memmap2` checks that internally, so + // it's kind of redundant to check it here, but we need to guard the `usize` cast in any case. + if offset_len <= isize::MAX as u64 - seek_offset { + // We have a seekable file that's long enough to be worth mapping, but not too long to map + // (e.g. on a 32-bit system). Try to map it. If this succeeds, we'll assume the caller + // isn't going to do any ordinary reads, so we don't need to `rewind`. + let mut mmap_options = memmap2::MmapOptions::new(); + mmap_options.len((offset_len + seek_offset) as usize); // checked above + if let Ok(mmap) = unsafe { mmap_options.map(&*file) } { + return Ok(Some(mmap)); + } + } + // `mmap` failed (or would've failed), so we need to `rewind` and let the caller do ordinary + // reads. This is the only failure case where we return `Err`, since if it does fail somehow + // (not clear if that's possible in practice), the file cursor position will be wrong. + file.rewind()?; + Ok(None) +} + +#[cfg(all(test, feature = "mmap"))] +mod test { + use super::*; + use std::io; + use std::io::prelude::*; + + #[test] + fn test_maybe_mmap_small_files() -> io::Result<()> { + let test_cases = [0, 1, MINIMUM_MMAP_SIZE - 2, MINIMUM_MMAP_SIZE - 1]; + for len in test_cases { + dbg!(len); + // Create a file smaller than 16 KiB. `maybe_mmap_file` should return `Ok(None)`. + let mut input = vec![0; len as usize]; + crate::test::paint_test_input(&mut input); + let mut f = tempfile::NamedTempFile::new()?; + f.write_all(&input)?; + f.flush()?; + // We have a debug assert that the initial file offset is 0. + f.rewind()?; + assert!(maybe_mmap_file(f.as_file_mut())?.is_none()); + // Check that the file cursor remains at start-of-file. + assert_eq!(f.stream_position()?, 0); + assert_eq!( + crate::hash(&input), + crate::Hasher::new() + .update_reader(f.as_file_mut())? + .finalize(), + ); + } + Ok(()) + } + + #[test] + fn test_maybe_mmap_mappable_files() -> io::Result<()> { + let test_cases = [MINIMUM_MMAP_SIZE, MINIMUM_MMAP_SIZE + 1]; + for len in test_cases { + dbg!(len); + // Create a file that's 16 KiB or larger. `maybe_mmap_file` should return `Ok(Some(_))`. + let mut input = vec![0; len as usize]; + crate::test::paint_test_input(&mut input); + let mut f = tempfile::NamedTempFile::new()?; + f.write_all(&input)?; + f.flush()?; + // We have a debug assert that the initial file offset is 0. + f.rewind()?; + let Ok(Some(mmap)) = maybe_mmap_file(f.as_file_mut()) else { + panic!("mmap failed"); + }; + // `maybe_mmap_file` doesn't `rewind` the file in this case, so we need to do that + // ourselves. + assert_ne!(f.stream_position()?, 0); + f.rewind()?; + assert_eq!(mmap[..], input[..]); + assert_eq!(crate::hash(&input), crate::hash(&mmap)); + assert_eq!( + crate::hash(&input), + crate::Hasher::new() + .update_reader(f.as_file_mut())? + .finalize(), + ); + } + Ok(()) + } + + #[test] + fn test_maybe_mmap_current_exe() -> io::Result<()> { + // The current executable should always be a regular file larger than 16 KiB, so mmap + // should ~always succeed. (A filesystem might not support mmap at all, but we don't test + // any of those in CI.) + let mut exe_file = File::open(std::env::current_exe()?)?; + assert!(exe_file.metadata()?.len() > MINIMUM_MMAP_SIZE); + let mmap = maybe_mmap_file(&mut exe_file)?.expect("maybe_mmap_file should return Some"); + // Mainly we're testing that we got `Some` above, but go ahead and read the mmap just to + // make sure it doesn't bus fault or anything like that. `maybe_mmap_file` doesn't `rewind` + // the file in this case, so we need to do that ourselves. + exe_file.rewind()?; + assert_eq!( + crate::hash(&mmap), + crate::Hasher::new().update_reader(&exe_file)?.finalize(), + ); + Ok(()) + } + + #[cfg(target_os = "linux")] + #[test] + fn test_unmappable_linux() -> io::Result<()> { + // I'm not aware of any similarly unmappable paths on macOS or Windows, so this test is + // Linux-only for now. + let unmappable_path = "/sys/kernel/btf/vmlinux"; + let mut unmappable_file = File::open(unmappable_path)?; + // The file is large enough to attempt mmapping. + assert!(unmappable_file.metadata()?.len() > MINIMUM_MMAP_SIZE); + // We're allowed to read the file. + assert_eq!(unmappable_file.read(&mut [0])?, 1); + // But mmapping the file fails. (We have a debug assert that requires `rewind` here.) + unmappable_file.rewind()?; + unsafe { memmap2::Mmap::map(&unmappable_file) }.unwrap_err(); + // `maybe_mmap_file` swallows that error and returns `None`. + assert!(maybe_mmap_file(&mut unmappable_file)?.is_none()); + Ok(()) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/lib.rs new/BLAKE3-1.8.6/src/lib.rs --- old/BLAKE3-1.8.4/src/lib.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/lib.rs 2026-08-06 00:26:34.000000000 +0200 @@ -135,6 +135,7 @@ #[cfg(feature = "traits-preview")] pub mod traits; +#[cfg(feature = "std")] mod io; mod join; @@ -142,7 +143,7 @@ use arrayvec::{ArrayString, ArrayVec}; use core::cmp; use core::fmt; -use platform::{Platform, MAX_SIMD_DEGREE, MAX_SIMD_DEGREE_OR_2}; +use platform::{MAX_SIMD_DEGREE, MAX_SIMD_DEGREE_OR_2, Platform}; #[cfg(feature = "zeroize")] use zeroize::Zeroize; @@ -170,7 +171,7 @@ // While iterating the compression function within a chunk, the CV is // represented as words, to avoid doing two extra endianness conversions for // each compression in the portable implementation. But the hash_many interface -// needs to hash both input bytes and parent nodes, so its better for its +// needs to hash both input bytes and parent nodes, so it's better for its // output CVs to be represented as bytes. type CVWords = [u32; 8]; type CVBytes = [u8; 32]; // little-endian @@ -241,7 +242,7 @@ impl Hash { /// The raw bytes of the `Hash`. Note that byte arrays don't provide - /// constant-time equality checking, so if you need to compare hashes, + /// constant-time equality checking, so if you need to compare hashes, /// prefer the `Hash` type. #[inline] pub const fn as_bytes(&self) -> &[u8; OUT_LEN] { @@ -1541,8 +1542,8 @@ /// ``` #[cfg(feature = "mmap")] pub fn update_mmap(&mut self, path: impl AsRef<std::path::Path>) -> std::io::Result<&mut Self> { - let file = std::fs::File::open(path.as_ref())?; - if let Some(mmap) = io::maybe_mmap_file(&file)? { + let mut file = std::fs::File::open(path.as_ref())?; + if let Some(mmap) = io::maybe_mmap_file(&mut file)? { self.update(&mmap); } else { io::copy_wide(&file, self)?; @@ -1596,8 +1597,8 @@ &mut self, path: impl AsRef<std::path::Path>, ) -> std::io::Result<&mut Self> { - let file = std::fs::File::open(path.as_ref())?; - if let Some(mmap) = io::maybe_mmap_file(&file)? { + let mut file = std::fs::File::open(path.as_ref())?; + if let Some(mmap) = io::maybe_mmap_file(&mut file)? { self.update_rayon(&mmap); } else { io::copy_wide(&file, self)?; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/platform.rs new/BLAKE3-1.8.6/src/platform.rs --- old/BLAKE3-1.8.4/src/platform.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/platform.rs 2026-08-06 00:26:34.000000000 +0200 @@ -1,4 +1,4 @@ -use crate::{portable, CVWords, IncrementCounter, BLOCK_LEN}; +use crate::{BLOCK_LEN, CVWords, IncrementCounter, portable}; use arrayref::{array_mut_ref, array_ref}; cfg_if::cfg_if! { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/portable.rs new/BLAKE3-1.8.6/src/portable.rs --- old/BLAKE3-1.8.4/src/portable.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/portable.rs 2026-08-06 00:26:34.000000000 +0200 @@ -1,6 +1,6 @@ use crate::{ - counter_high, counter_low, CVBytes, CVWords, IncrementCounter, BLOCK_LEN, IV, MSG_SCHEDULE, - OUT_LEN, + BLOCK_LEN, CVBytes, CVWords, IV, IncrementCounter, MSG_SCHEDULE, OUT_LEN, counter_high, + counter_low, }; use arrayref::{array_mut_ref, array_ref}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/rust_avx2.rs new/BLAKE3-1.8.6/src/rust_avx2.rs --- old/BLAKE3-1.8.4/src/rust_avx2.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/rust_avx2.rs 2026-08-06 00:26:34.000000000 +0200 @@ -4,7 +4,7 @@ use core::arch::x86_64::*; use crate::{ - counter_high, counter_low, CVWords, IncrementCounter, BLOCK_LEN, IV, MSG_SCHEDULE, OUT_LEN, + BLOCK_LEN, CVWords, IV, IncrementCounter, MSG_SCHEDULE, OUT_LEN, counter_high, counter_low, }; use arrayref::{array_mut_ref, mut_array_refs}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/rust_sse2.rs new/BLAKE3-1.8.6/src/rust_sse2.rs --- old/BLAKE3-1.8.4/src/rust_sse2.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/rust_sse2.rs 2026-08-06 00:26:34.000000000 +0200 @@ -4,8 +4,8 @@ use core::arch::x86_64::*; use crate::{ - counter_high, counter_low, CVBytes, CVWords, IncrementCounter, BLOCK_LEN, IV, MSG_SCHEDULE, - OUT_LEN, + BLOCK_LEN, CVBytes, CVWords, IV, IncrementCounter, MSG_SCHEDULE, OUT_LEN, counter_high, + counter_low, }; use arrayref::{array_mut_ref, array_ref, mut_array_refs}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/rust_sse41.rs new/BLAKE3-1.8.6/src/rust_sse41.rs --- old/BLAKE3-1.8.4/src/rust_sse41.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/rust_sse41.rs 2026-08-06 00:26:34.000000000 +0200 @@ -4,8 +4,8 @@ use core::arch::x86_64::*; use crate::{ - counter_high, counter_low, CVBytes, CVWords, IncrementCounter, BLOCK_LEN, IV, MSG_SCHEDULE, - OUT_LEN, + BLOCK_LEN, CVBytes, CVWords, IV, IncrementCounter, MSG_SCHEDULE, OUT_LEN, counter_high, + counter_low, }; use arrayref::{array_mut_ref, array_ref, mut_array_refs}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/test.rs new/BLAKE3-1.8.6/src/test.rs --- old/BLAKE3-1.8.4/src/test.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/test.rs 2026-08-06 00:26:34.000000000 +0200 @@ -1,4 +1,4 @@ -use crate::{CVBytes, CVWords, IncrementCounter, BLOCK_LEN, CHUNK_LEN, OUT_LEN}; +use crate::{BLOCK_LEN, CHUNK_LEN, CVBytes, CVWords, IncrementCounter, OUT_LEN}; use arrayref::array_ref; use arrayvec::ArrayVec; use core::usize; @@ -915,9 +915,6 @@ fn test_mmap_virtual_file() -> Result<(), std::io::Error> { // Virtual files like /proc/version can't be mmapped, because their contents don't actually // exist anywhere in memory. Make sure we fall back to regular file IO in these cases. - // Currently this is handled with a length check, where the assumption is that virtual files - // will always report length 0. If that assumption ever breaks, hopefully this test will catch - // it. let virtual_filepath = "/proc/version"; let mut mmap_hasher = crate::Hasher::new(); // We'll fail right here if the fallback doesn't work. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/src/wasm32_simd.rs new/BLAKE3-1.8.6/src/wasm32_simd.rs --- old/BLAKE3-1.8.4/src/wasm32_simd.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/src/wasm32_simd.rs 2026-08-06 00:26:34.000000000 +0200 @@ -17,8 +17,8 @@ use core::arch::wasm32::*; use crate::{ - counter_high, counter_low, CVBytes, CVWords, IncrementCounter, BLOCK_LEN, IV, MSG_SCHEDULE, - OUT_LEN, + BLOCK_LEN, CVBytes, CVWords, IV, IncrementCounter, MSG_SCHEDULE, OUT_LEN, counter_high, + counter_low, }; use arrayref::{array_mut_ref, array_ref, mut_array_refs}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/test_vectors/src/lib.rs new/BLAKE3-1.8.6/test_vectors/src/lib.rs --- old/BLAKE3-1.8.4/test_vectors/src/lib.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/test_vectors/src/lib.rs 2026-08-06 00:26:34.000000000 +0200 @@ -344,7 +344,9 @@ // newlines when files are checked out. let json = TEST_VECTORS_JSON.replace("\r\n", "\n"); if generate_json() != json { - panic!("Checked-in test_vectors.json is not up to date. Regenerate with `cargo run --bin generate > ./test_vectors.json`."); + panic!( + "Checked-in test_vectors.json is not up to date. Regenerate with `cargo run --bin generate > ./test_vectors.json`." + ); } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/tools/compiler_version/build.rs new/BLAKE3-1.8.6/tools/compiler_version/build.rs --- old/BLAKE3-1.8.4/tools/compiler_version/build.rs 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/tools/compiler_version/build.rs 2026-08-06 00:26:34.000000000 +0200 @@ -2,5 +2,5 @@ let build = cc::Build::new(); let compiler = build.get_compiler(); let compiler_path = compiler.path().to_string_lossy(); - println!("cargo:rustc-env=COMPILER_PATH={}", compiler_path); + println!("cargo::rustc-env=COMPILER_PATH={}", compiler_path); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/BLAKE3-1.8.4/tools/release.md new/BLAKE3-1.8.6/tools/release.md --- old/BLAKE3-1.8.4/tools/release.md 2026-03-30 18:41:51.000000000 +0200 +++ new/BLAKE3-1.8.6/tools/release.md 2026-08-06 00:26:34.000000000 +0200 @@ -5,6 +5,7 @@ - Bump the version in b3sum/Cargo.toml. - Bump the dependency on the root crate too, if new features are used. - Delete b3sum/Cargo.lock and recreate it with `cargo build` or similar. + - Make sure to do this *after* the previous step. - Update the `-h` output in b3sum/README.md if it's changed. - Bump `BLAKE3_VERSION_STRING` in c/blake3.h. - Bump `VERSION` in c/CMakeLists.txt. ++++++ vendor.tar.zst ++++++ /work/SRC/openSUSE:Factory/blake3/vendor.tar.zst /work/SRC/openSUSE:Factory/.blake3.new.17972/vendor.tar.zst differ: char 7, line 1
