Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-hashable for openSUSE:Factory checked in at 2021-09-10 23:40:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-hashable (Old) and /work/SRC/openSUSE:Factory/.ghc-hashable.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-hashable" Fri Sep 10 23:40:57 2021 rev:29 rq:917352 version:1.3.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-hashable/ghc-hashable.changes 2021-06-01 10:40:28.909121550 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-hashable.new.1899/ghc-hashable.changes 2021-09-10 23:41:07.346547329 +0200 @@ -1,0 +2,10 @@ +Wed Aug 25 10:24:30 UTC 2021 - [email protected] + +- Update hashable to version 1.3.3.0. + ## Version 1.3.3.0 + + * `Text` hashing uses 64-bit FNV prime + * Don't truncate Text hashvalues on 64bit Windows: + https://github.com/haskell-unordered-containers/hashable/pull/211 + +------------------------------------------------------------------- Old: ---- hashable-1.3.2.0.tar.gz New: ---- hashable-1.3.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-hashable.spec ++++++ --- /var/tmp/diff_new_pack.FZMTfX/_old 2021-09-10 23:41:07.854547870 +0200 +++ /var/tmp/diff_new_pack.FZMTfX/_new 2021-09-10 23:41:07.858547874 +0200 @@ -19,7 +19,7 @@ %global pkg_name hashable %bcond_with tests Name: ghc-%{pkg_name} -Version: 1.3.2.0 +Version: 1.3.3.0 Release: 0 Summary: A class for types that can be converted to a hash value License: BSD-3-Clause ++++++ hashable-1.3.2.0.tar.gz -> hashable-1.3.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hashable-1.3.2.0/CHANGES.md new/hashable-1.3.3.0/CHANGES.md --- old/hashable-1.3.2.0/CHANGES.md 2001-09-09 03:46:40.000000000 +0200 +++ new/hashable-1.3.3.0/CHANGES.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,11 @@ See also https://pvp.haskell.org/faq +## Version 1.3.3.0 + + * `Text` hashing uses 64-bit FNV prime + * Don't truncate Text hashvalues on 64bit Windows: + https://github.com/haskell-unordered-containers/hashable/pull/211 + ## Version 1.3.2.0 * Add `Hashable (Fixed a)` for `base <4.7` versions. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hashable-1.3.2.0/cbits/fnv.c new/hashable-1.3.3.0/cbits/fnv.c --- old/hashable-1.3.2.0/cbits/fnv.c 2001-09-09 03:46:40.000000000 +0200 +++ new/hashable-1.3.3.0/cbits/fnv.c 2001-09-09 03:46:40.000000000 +0200 @@ -31,24 +31,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "MachDeps.h" - -#if WORD_SIZE_IN_BITS == 64 -#define FNV_PRIME 1099511628211 -#else -#define FNV_PRIME 16777619 -#endif +#include "HsHashable.h" /* FNV-1 hash * * The FNV-1 hash description: http://isthe.com/chongo/tech/comp/fnv/ * The FNV-1 hash is public domain: http://isthe.com/chongo/tech/comp/fnv/#public_domain */ -long hashable_fnv_hash(const unsigned char* str, long len, long salt) { +FNV_UNSIGNED hashable_fnv_hash(const unsigned char* str, FNV_SIGNED len, FNV_UNSIGNED salt) { - unsigned long hash = salt; + FNV_UNSIGNED hash = salt; while (len--) { - hash = (hash * 16777619) ^ *str++; + hash = (hash * FNV_PRIME) ^ *str++; } return hash; @@ -57,6 +51,6 @@ /* Used for ByteArray#s. We can't treat them like pointers in native Haskell, but we can in unsafe FFI calls. */ -long hashable_fnv_hash_offset(const unsigned char* str, long offset, long len, long salt) { +FNV_UNSIGNED hashable_fnv_hash_offset(const unsigned char* str, FNV_SIGNED offset, FNV_SIGNED len, FNV_UNSIGNED salt) { return hashable_fnv_hash(str + offset, len, salt); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hashable-1.3.2.0/hashable.cabal new/hashable-1.3.3.0/hashable.cabal --- old/hashable-1.3.2.0/hashable.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/hashable-1.3.3.0/hashable.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,6 +1,6 @@ cabal-version: 1.12 name: hashable -version: 1.3.2.0 +version: 1.3.3.0 synopsis: A class for types that can be converted to a hash value description: This package defines a class, 'Hashable', for types that @@ -37,10 +37,12 @@ || ==8.8.3 || ==8.10.4 || ==9.0.1 + || ==9.2.* extra-source-files: CHANGES.md README.md + include/HsHashable.h flag integer-gmp description: @@ -69,16 +71,17 @@ Data.Hashable.Generic.Instances c-sources: cbits/fnv.c + include-dirs: include hs-source-dirs: src build-depends: - base >=4.5 && <4.16 + base >=4.5 && <4.17 , bytestring >=0.9 && <0.12 , deepseq >=1.3 && <1.5 , ghc-prim , text >=0.12 && <1.3 if impl(ghc >=9) - build-depends: ghc-bignum ==1.0.* + build-depends: ghc-bignum ==1.0.* || ==1.2.* else if flag(integer-gmp) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hashable-1.3.2.0/include/HsHashable.h new/hashable-1.3.3.0/include/HsHashable.h --- old/hashable-1.3.2.0/include/HsHashable.h 1970-01-01 01:00:00.000000000 +0100 +++ new/hashable-1.3.3.0/include/HsHashable.h 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,22 @@ +#ifndef HS_HASHABLE_H +#define HS_HASHABLE_H + +#include "MachDeps.h" +#include <stdint.h> + +#if WORD_SIZE_IN_BITS == 64 +#define FNV_PRIME 1099511628211 +#define FNV_SIGNED int64_t +#define FNV_UNSIGNED uint64_t +#else +#define FNV_PRIME 16777619 +#define FNV_SIGNED int32_t +#define FNV_UNSIGNED uint32_t +#endif + +uint64_t hs_hashable_init(); + +FNV_UNSIGNED hashable_fnv_hash(const unsigned char* str, FNV_SIGNED len, FNV_UNSIGNED salt); +FNV_UNSIGNED hashable_fnv_hash_offset(const unsigned char* str, FNV_SIGNED offset, FNV_SIGNED len, FNV_UNSIGNED salt); + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hashable-1.3.2.0/src/Data/Hashable/Class.hs new/hashable-1.3.3.0/src/Data/Hashable/Class.hs --- old/hashable-1.3.2.0/src/Data/Hashable/Class.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/hashable-1.3.3.0/src/Data/Hashable/Class.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,7 +1,7 @@ {-# LANGUAGE BangPatterns, CPP, MagicHash, ScopedTypeVariables, UnliftedFFITypes, DeriveDataTypeable, DefaultSignatures, FlexibleContexts, TypeFamilies, - MultiParamTypeClasses #-} + MultiParamTypeClasses, CApiFFI #-} {-# LANGUAGE Trustworthy #-} @@ -121,13 +121,7 @@ import GHC.Fingerprint.Type(Fingerprint(..)) #endif -#if MIN_VERSION_base(4,5,0) -import Foreign.C (CLong(..)) import Foreign.C.Types (CInt(..)) -#else -import Foreign.C (CLong) -import Foreign.C.Types (CInt) -#endif #if !(MIN_VERSION_base(4,8,0)) import Data.Word (Word) @@ -210,7 +204,7 @@ initialSeed = unsafePerformIO initialSeedC {-# NOINLINE initialSeed #-} -foreign import ccall "hs_hashable_init" initialSeedC :: IO Word64 +foreign import capi "HsHashable.h hs_hashable_init" initialSeedC :: IO Word64 #endif -- | A default salt used in the implementation of 'hash'. @@ -354,6 +348,8 @@ -- > -- > instance Hashable Foo where -- > hashWithSalt = hashUsing fromEnum +-- +-- @since 1.2.0.0 hashUsing :: (Hashable b) => (a -> b) -- ^ Transformation function. -> Int -- ^ Salt. @@ -721,6 +717,7 @@ hashThreadId :: ThreadId -> Int hashThreadId (ThreadId t) = hash (fromIntegral (getThreadId t) :: Int) +-- this cannot be capi, as GHC panics. foreign import ccall unsafe "rts_getThreadId" getThreadId :: ThreadId# -> CInt @@ -814,8 +811,12 @@ fromIntegral `fmap` c_hashCString (castPtr p) (fromIntegral len) (fromIntegral salt) -foreign import ccall unsafe "hashable_fnv_hash" c_hashCString - :: CString -> CLong -> CLong -> IO CLong +foreign import capi unsafe "HsHashable.h hashable_fnv_hash" c_hashCString +#if WORD_SIZE_IN_BITS == 64 + :: CString -> Int64 -> Int64 -> IO Word64 +#else + :: CString -> Int32 -> Int32 -> IO Word32 +#endif -- | Compute a hash value for the content of this 'ByteArray#', -- beginning at the specified offset, using specified number of bytes. @@ -842,8 +843,16 @@ fromIntegral $ c_hashByteArray ba (fromIntegral off) (fromIntegral len) (fromIntegral h) +#if __GLASGOW_HASKELL__ >= 802 +foreign import capi unsafe "HsHashable.h hashable_fnv_hash_offset" c_hashByteArray +#else foreign import ccall unsafe "hashable_fnv_hash_offset" c_hashByteArray - :: ByteArray# -> CLong -> CLong -> CLong -> CLong +#endif +#if WORD_SIZE_IN_BITS == 64 + :: ByteArray# -> Int64 -> Int64 -> Int64 -> Word64 +#else + :: ByteArray# -> Int32 -> Int32 -> Int32 -> Word32 +#endif -- | Combine two given hash values. 'combine' has zero as a left -- identity. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hashable-1.3.2.0/tests/Regress.hs new/hashable-1.3.3.0/tests/Regress.hs --- old/hashable-1.3.2.0/tests/Regress.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/hashable-1.3.3.0/tests/Regress.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE OverloadedStrings #-} module Regress (regressions) where @@ -9,6 +10,7 @@ import GHC.Generics (Generic) import Data.List (nub) import Data.Fixed (Pico) +import Data.Text (Text) #ifdef HAVE_MMAP import qualified Regress.Mmap as Mmap @@ -16,6 +18,8 @@ import Data.Hashable +#include "MachDeps.h" + regressions :: [F.Test] regressions = [] ++ #ifdef HAVE_MMAP @@ -35,6 +39,10 @@ let ns = take 20 $ iterate S Z let hs = map hash ns hs @=? nub hs +#if WORD_SIZE_IN_BITS == 64 + , testCase "64 bit Text" $ do + hash ("hello world" :: Text) @=? 2668910425102664189 +#endif ] where nullaryCase :: Int -> SumOfNullary -> IO ()
