# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/kicad/hotfix-boost-sha1.patch # Copyright (C) 2024 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- From 9779ee0fd3c8891d80b0a75edc1ce673d7a82b0a Mon Sep 17 00:00:00 2001 From: John Beard Date: Tue, 10 Sep 2024 12:08:12 +0100 Subject: [PATCH] Fix Boost 1.86 SHA1 one last time There's a change in Boost 1.86 that breaks the SHA1 hashing in 3D cache. The master KiCad branch ditches SHA1 entirely here, but it's quite an invasive change to backport. So apply a sticking plaster for the remainder of v8. Relates-To: https://gitlab.archlinux.org/archlinux/packaging/packages/kicad/-/issues/1 --- 3d-viewer/3d_cache/3d_cache.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/3d-viewer/3d_cache/3d_cache.cpp b/3d-viewer/3d_cache/3d_cache.cpp index 33c04d0fffd..72dd50d734e 100644 --- a/3d-viewer/3d_cache/3d_cache.cpp +++ b/3d-viewer/3d_cache/3d_cache.cpp @@ -381,7 +381,13 @@ bool S3D_CACHE::getSHA1( const wxString& aFileName, unsigned char* aSHA1Sum ) fclose( fp ); unsigned int digest[5]; - dblock.get_digest( digest ); + // V8 only + // Boost 1.86 and later changed digest_type from uchar[20] from int[5] + // But KiCad 8.99 and later use MurmurHash3 here, so just do a fairly ugly cast to keep + // this going for another few months. + static_assert( sizeof( digest ) == sizeof( boost::uuids::detail::sha1::digest_type& ), + "SHA1 digest size mismatch" ); + dblock.get_digest( reinterpret_cast( digest ) ); // ensure MSB order for( int i = 0; i < 5; ++i ) -- GitLab From 9fdd825681fb5c639470f8a68f1bf4cf73cc5cd1 Mon Sep 17 00:00:00 2001 From: John Beard Date: Sat, 7 Sep 2024 16:13:42 +0100 Subject: [PATCH] KIID: Use Boost uuids own hash function (fix Boost 1.86) Not only is this simpler, but it should be compatible with all Boost versions (the cast is a problem in 1.86) and it was also 'improved' in 1.86 for better mixing. Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18651 (cherry picked from commit 9a3ebfba404e43d82b5c194e01f6afb67909bf88) --- common/kiid.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/common/kiid.cpp b/common/kiid.cpp index 80aea3e55da..81266cbd226 100644 --- a/common/kiid.cpp +++ b/common/kiid.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #if BOOST_VERSION >= 106700 #include @@ -236,15 +235,7 @@ timestamp_t KIID::AsLegacyTimestamp() const size_t KIID::Hash() const { - size_t hash = 0; - - // Note: this is NOT little-endian/big-endian safe, but as long as it's just used - // at runtime it won't matter. - - for( int i = 0; i < 4; ++i ) - boost::hash_combine( hash, reinterpret_cast( m_uuid.data )[i] ); - - return hash; + return boost::uuids::hash_value( m_uuid ); } -- GitLab From f4f9513f808fae515acf8253269a4eec9a667cd5 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Tue, 27 Aug 2024 11:49:28 +0100 Subject: [PATCH] Fix compilation with Boost 1.86 Boost 1.86 removed the boost::random dependency from boost::uuid, so we need to include those headers on our own now to use the random mersenne twister implementation. (cherry picked from commit a9e115925a5168034f60d0fe1e7b369861f84b82) --- common/kiid.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/kiid.cpp b/common/kiid.cpp index 4c7e8eb18cd..80aea3e55da 100644 --- a/common/kiid.cpp +++ b/common/kiid.cpp @@ -25,6 +25,7 @@ #include +#include #include #include #include -- GitLab