On Wed 01/01/2025 11:50, Stuart Henderson wrote:
> On 2024/12/30 21:44, Bjorn Ketelaars wrote:
> > CVSROOT:    /cvs
> > Module name:        ports
> > Changes by: [email protected]    2024/12/30 21:44:21
> > 
> > Modified files:
> >     sysutils/xxhash: Makefile distinfo 
> >     sysutils/xxhash/patches: patch-Makefile patch-xxhash_h 
> >     sysutils/xxhash/pkg: PLIST 
> > Removed files:
> >     sysutils/xxhash/patches: patch-cli_xsum_os_specific_c 
> > 
> > Log message:
> > Update to xxhash-0.8.3
> > 
> > Changes: https://github.com/Cyan4973/xxHash/releases/tag/v0.8.3
> > 
> > OK kn@
> > 
> 
> This breaks PHP,
> 
> ext/hash/hash_xxhash.c:82:13: error: no member named 'memsize' in 'struct 
> XXH_NAMESPACEXXH32_state_s'
> ext/hash/hash_xxhash.c:230:13: error: no member named 'memsize' in 'struct 
> XXH_NAMESPACEXXH64_state_s'

Sorry for this!

Interestingly is that php-8.2 and php-8.3 are broken and php-8.4 builds.
In all branches, xxhash is used as a header-only library, and the file
is included in the PHP distribution in a subdir. As /usr/local/include
is ahead in the -I path xxhash from ports gets picked up in preference.
As 8.4 builds, it seems that it uses the php included header.

That said, 8.2 and 8.3 are still broken, which is caused by a very
recent commit to xxhash [0] that updated the name of several struct
members.

Not sure what the best way forward is:
1.) Easy fix is to revert xxhash back to 0.8.2, bump consumers. Downside
  is that we most likely will be 'stuck' with xxhash-0.8.2 for some
  time;
2.) Have 8.2 and 8.3 pick up the provided header file. This is what 8.4
  probably is doing. To be honest I do not understand why this is;
3.) Patch 8.2 and 8.3 to get it to build with xxhash-0.8.3. Downside is
  that this probably needs some testing to make sure that nothing else
  is broken. Diff enclosed below. With this I'm able to build php-8.2
  and -8.3. At least a simple test like 'hash('xxh32', 'php.watch');'
  provides the correct hash.

Your opinion on this?

[0]
https://github.com/Cyan4973/xxHash/commit/bca2d275b258c2a99af90f70b265d9d2f9d745de


diff --git 8.2/Makefile 8.2/Makefile
index 57429bd6bd3..49b6be3f5a3 100644
--- 8.2/Makefile
+++ 8.2/Makefile
@@ -4,7 +4,7 @@ AUTOCONF_VERSION= 2.72
 # keep all subpackages above 7.6-stable; @pkgpath markers, WANTLIB-gd
 REVISION=      0
 
-REVISION-main= 1
+REVISION-main= 2
 
 DEFAULT_PHP=   Yes
 PHP_PKGSPEC=   >=8.2,<8.3
diff --git 8.2/patches/patch-ext_hash_hash_xxhash_c 
8.2/patches/patch-ext_hash_hash_xxhash_c
new file mode 100644
index 00000000000..b372339bfa1
--- /dev/null
+++ 8.2/patches/patch-ext_hash_hash_xxhash_c
@@ -0,0 +1,23 @@
+xxhash-0.8.3 renamed struct member memsize to bufferedSize.
+
+Index: ext/hash/hash_xxhash.c
+--- ext/hash/hash_xxhash.c.orig
++++ ext/hash/hash_xxhash.c
+@@ -79,7 +79,7 @@ static int php_hash_xxh32_unserialize(
+       int r = FAILURE;
+       if (magic == PHP_HASH_SERIALIZE_MAGIC_SPEC
+               && (r = php_hash_unserialize_spec(hash, zv, PHP_XXH32_SPEC)) == 
SUCCESS
+-              && ctx->s.memsize < 16) {
++              && ctx->s.bufferedSize < 16) {
+               return SUCCESS;
+       } else {
+               return r != SUCCESS ? r : -2000;
+@@ -227,7 +227,7 @@ static int php_hash_xxh64_unserialize(
+       int r = FAILURE;
+       if (magic == PHP_HASH_SERIALIZE_MAGIC_SPEC
+               && (r = php_hash_unserialize_spec(hash, zv, PHP_XXH64_SPEC)) == 
SUCCESS
+-              && ctx->s.memsize < 32) {
++              && ctx->s.bufferedSize < 32) {
+               return SUCCESS;
+       } else {
+               return r != SUCCESS ? r : -2000;
diff --git 8.3/Makefile 8.3/Makefile
index 4c16232acbd..88a5e8e2bdd 100644
--- 8.3/Makefile
+++ 8.3/Makefile
@@ -4,7 +4,7 @@ AUTOCONF_VERSION= 2.72
 # keep -gd above 7.6-stable; WANTLIB
 REVISION-gd=   0
 
-REVISION-main= 1
+REVISION-main= 2
 
 PHP_PKGSPEC=   >=8.3,<8.4
 PHP_EXTENSIONS += -imap -pspell
diff --git 8.3/patches/patch-ext_hash_hash_xxhash_c 
8.3/patches/patch-ext_hash_hash_xxhash_c
new file mode 100644
index 00000000000..b372339bfa1
--- /dev/null
+++ 8.3/patches/patch-ext_hash_hash_xxhash_c
@@ -0,0 +1,23 @@
+xxhash-0.8.3 renamed struct member memsize to bufferedSize.
+
+Index: ext/hash/hash_xxhash.c
+--- ext/hash/hash_xxhash.c.orig
++++ ext/hash/hash_xxhash.c
+@@ -79,7 +79,7 @@ static int php_hash_xxh32_unserialize(
+       int r = FAILURE;
+       if (magic == PHP_HASH_SERIALIZE_MAGIC_SPEC
+               && (r = php_hash_unserialize_spec(hash, zv, PHP_XXH32_SPEC)) == 
SUCCESS
+-              && ctx->s.memsize < 16) {
++              && ctx->s.bufferedSize < 16) {
+               return SUCCESS;
+       } else {
+               return r != SUCCESS ? r : -2000;
+@@ -227,7 +227,7 @@ static int php_hash_xxh64_unserialize(
+       int r = FAILURE;
+       if (magic == PHP_HASH_SERIALIZE_MAGIC_SPEC
+               && (r = php_hash_unserialize_spec(hash, zv, PHP_XXH64_SPEC)) == 
SUCCESS
+-              && ctx->s.memsize < 32) {
++              && ctx->s.bufferedSize < 32) {
+               return SUCCESS;
+       } else {
+               return r != SUCCESS ? r : -2000;

Reply via email to