all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#67300] [PATCH gnome-team] gnu: appstream: Fix test.
@ 2023-11-15 23:12 Vivien Kraus via Guix-patches via
  2023-11-15 23:12 ` [bug#67300] [PATCH gnome-team v2] gnu: appstream: Load stemmer in all circumstances Vivien Kraus via Guix-patches via
  2023-11-20 19:48 ` [bug#67300] [PATCH gnome-team] gnu: appstream: Fix test Liliana Marie Prikler
  0 siblings, 2 replies; 4+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-11-15 23:12 UTC (permalink / raw)
  To: 67300; +Cc: rg, liliana.prikler, maxim.cournoyer

* gnu/packages/patches/appstream-load-stemmer-early.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/freedesktop.scm (appstream) [patches]: Use it here.
[#:phases]<disable-failing-tests>: Remove.

Change-Id: Iddd6ce5887247df46f670c49f9efc66772c82ff0
---
 gnu/local.mk                                  |  1 +
 gnu/packages/freedesktop.scm                  |  9 +-
 .../appstream-force-reload-stemmer.patch      | 89 +++++++++++++++++++
 3 files changed, 93 insertions(+), 6 deletions(-)
 create mode 100644 gnu/packages/patches/appstream-force-reload-stemmer.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a939b9be8d..5cb9874d9f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -918,6 +918,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/antlr3-3_1-fix-java8-compilation.patch	\
   %D%/packages/patches/antlr3-3_3-fix-java8-compilation.patch	\
   %D%/packages/patches/aoflagger-use-system-provided-pybind11.patch \
+  %D%/packages/patches/appstream-force-reload-stemmer.patch	\
   %D%/packages/patches/apr-fix-atomics.patch			\
   %D%/packages/patches/apr-skip-getservbyname-test.patch	\
   %D%/packages/patches/ark-skip-xar-test.patch			\
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 0aeeadf5a3..25b7998d05 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -148,7 +148,9 @@ (define-public appstream
                        "appstream/releases/"
                        "AppStream-" version ".tar.xz"))
        (sha256
-        (base32 "1val1b3dggn9g33q2r9q7wsl75a64x4lcvswvkcjjbvakkbj5xyl"))))
+        (base32 "1val1b3dggn9g33q2r9q7wsl75a64x4lcvswvkcjjbvakkbj5xyl"))
+       (patches
+        (search-patches "appstream-force-reload-stemmer.patch"))))
     (build-system meson-build-system)
     (arguments
      (list
@@ -163,11 +165,6 @@ (define-public appstream
               (substitute* "meson.build"
                 (("/usr/include")
                  (dirname libstemmer.h))))))
-          (add-after 'unpack 'disable-failing-tests
-            (lambda _
-              (substitute* "tests/test-pool.c"
-                (("[ \t]*g_test_add_func \\(\"/AppStream/Stemming.*;")
-                 ""))))
           (add-before 'check 'check-setup
             (lambda _
               (setenv "HOME" (getcwd)))))))
diff --git a/gnu/packages/patches/appstream-force-reload-stemmer.patch b/gnu/packages/patches/appstream-force-reload-stemmer.patch
new file mode 100644
index 0000000000..a2cf84c8b1
--- /dev/null
+++ b/gnu/packages/patches/appstream-force-reload-stemmer.patch
@@ -0,0 +1,89 @@
+From 32182d7a7a67d0d204cd0a37bd211bfd0177bc27 Mon Sep 17 00:00:00 2001
+Message-ID: <32182d7a7a67d0d204cd0a37bd211bfd0177bc27.1700093066.git.vivien@planete-kraus.eu>
+From: Matthias Klumpp <matthias@tenstral.net>
+Date: Thu, 16 Nov 2023 00:59:15 +0100
+Subject: [PATCH] stemmer: Resolve potential issue where stemmer may never be
+ initialized
+
+If the initial locale was equal to the current stemming language, we may
+never have initialized the stemmer (which could lead to crashes or
+stemming being disabled).
+
+So we force the reload to always happen on initialization.
+CC: #558
+---
+ src/as-stemmer.c | 33 +++++++++++++++++++++------------
+ 1 file changed, 21 insertions(+), 12 deletions(-)
+
+diff --git a/src/as-stemmer.c b/src/as-stemmer.c
+index 63d45267..16ebd09b 100644
+--- a/src/as-stemmer.c
++++ b/src/as-stemmer.c
+@@ -47,6 +47,8 @@ G_DEFINE_TYPE (AsStemmer, as_stemmer, G_TYPE_OBJECT)
+ 
+ static gpointer as_stemmer_object = NULL;
+ 
++static void as_stemmer_reload_internal (AsStemmer *stemmer, const gchar *locale, gboolean force);
++
+ /**
+  * as_stemmer_finalize:
+  **/
+@@ -76,21 +78,14 @@ as_stemmer_init (AsStemmer *stemmer)
+ 
+ 	/* we don't use the locale in XML, so it can be POSIX */
+ 	locale = as_get_current_locale_posix ();
+-	stemmer->current_lang = as_utils_locale_to_language (locale);
+ 
+-	as_stemmer_reload (stemmer, stemmer->current_lang);
++	/* force a reload for initialization */
++	as_stemmer_reload_internal (stemmer, locale, TRUE);
+ #endif
+ }
+ 
+-/**
+- * as_stemmer_reload:
+- * @stemmer: A #AsStemmer
+- * @locale: The stemming language as POSIX locale.
+- *
+- * Allows realoading the #AsStemmer with a different language.
+- */
+-void
+-as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
++static void
++as_stemmer_reload_internal (AsStemmer *stemmer, const gchar *locale, gboolean force)
+ {
+ #ifdef HAVE_STEMMING
+ 	g_autofree gchar *lang = NULL;
+@@ -99,7 +94,7 @@ as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
+ 	/* check if we need to reload */
+ 	lang = as_utils_locale_to_language (locale);
+ 	locker = g_mutex_locker_new (&stemmer->mutex);
+-	if (as_str_equal0 (lang, stemmer->current_lang)) {
++	if (!force && as_str_equal0 (lang, stemmer->current_lang)) {
+ 		g_mutex_locker_free (locker);
+ 		return;
+ 	}
+@@ -119,6 +114,20 @@ as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
+ #endif
+ }
+ 
++/**
++ * as_stemmer_reload:
++ * @stemmer: A #AsStemmer
++ * @locale: The stemming language as POSIX locale.
++ *
++ * Allows realoading the #AsStemmer with a different language.
++ * Does nothing if the stemmer is already using the selected language.
++ */
++void
++as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
++{
++	as_stemmer_reload_internal (stemmer, locale, FALSE);
++}
++
+ /**
+  * as_stemmer_stem:
+  * @stemmer: A #AsStemmer
+-- 
+2.41.0
+

base-commit: 1cc3b7e80f60a2a5a6a1400ed0b025efeae7a523
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#67300] [PATCH gnome-team v2] gnu: appstream: Load stemmer in all circumstances.
  2023-11-15 23:12 [bug#67300] [PATCH gnome-team] gnu: appstream: Fix test Vivien Kraus via Guix-patches via
@ 2023-11-15 23:12 ` Vivien Kraus via Guix-patches via
  2023-11-23  8:07   ` bug#67300: " Liliana Marie Prikler
  2023-11-20 19:48 ` [bug#67300] [PATCH gnome-team] gnu: appstream: Fix test Liliana Marie Prikler
  1 sibling, 1 reply; 4+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-11-15 23:12 UTC (permalink / raw)
  To: 67300, Liliana Marie Prikler; +Cc: rg, maxim.cournoyer

If the default stemmer language is computed to be "en", such as in a Guix
build container, then the stemmer will not be loaded.

* gnu/packages/patches/appstream-load-stemmer-early.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/freedesktop.scm (appstream) [patches]: Use it here.
[#:phases]<disable-failing-tests>: Remove.

Change-Id: Iddd6ce5887247df46f670c49f9efc66772c82ff0
---
 gnu/local.mk                                  |  1 +
 gnu/packages/freedesktop.scm                  |  9 +-
 .../appstream-force-reload-stemmer.patch      | 89 +++++++++++++++++++
 3 files changed, 93 insertions(+), 6 deletions(-)
 create mode 100644 gnu/packages/patches/appstream-force-reload-stemmer.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a939b9be8d..5cb9874d9f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -918,6 +918,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/antlr3-3_1-fix-java8-compilation.patch	\
   %D%/packages/patches/antlr3-3_3-fix-java8-compilation.patch	\
   %D%/packages/patches/aoflagger-use-system-provided-pybind11.patch \
+  %D%/packages/patches/appstream-force-reload-stemmer.patch	\
   %D%/packages/patches/apr-fix-atomics.patch			\
   %D%/packages/patches/apr-skip-getservbyname-test.patch	\
   %D%/packages/patches/ark-skip-xar-test.patch			\
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 0aeeadf5a3..25b7998d05 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -148,7 +148,9 @@ (define-public appstream
                        "appstream/releases/"
                        "AppStream-" version ".tar.xz"))
        (sha256
-        (base32 "1val1b3dggn9g33q2r9q7wsl75a64x4lcvswvkcjjbvakkbj5xyl"))))
+        (base32 "1val1b3dggn9g33q2r9q7wsl75a64x4lcvswvkcjjbvakkbj5xyl"))
+       (patches
+        (search-patches "appstream-force-reload-stemmer.patch"))))
     (build-system meson-build-system)
     (arguments
      (list
@@ -163,11 +165,6 @@ (define-public appstream
               (substitute* "meson.build"
                 (("/usr/include")
                  (dirname libstemmer.h))))))
-          (add-after 'unpack 'disable-failing-tests
-            (lambda _
-              (substitute* "tests/test-pool.c"
-                (("[ \t]*g_test_add_func \\(\"/AppStream/Stemming.*;")
-                 ""))))
           (add-before 'check 'check-setup
             (lambda _
               (setenv "HOME" (getcwd)))))))
diff --git a/gnu/packages/patches/appstream-force-reload-stemmer.patch b/gnu/packages/patches/appstream-force-reload-stemmer.patch
new file mode 100644
index 0000000000..a2cf84c8b1
--- /dev/null
+++ b/gnu/packages/patches/appstream-force-reload-stemmer.patch
@@ -0,0 +1,89 @@
+From 32182d7a7a67d0d204cd0a37bd211bfd0177bc27 Mon Sep 17 00:00:00 2001
+Message-ID: <32182d7a7a67d0d204cd0a37bd211bfd0177bc27.1700093066.git.vivien@planete-kraus.eu>
+From: Matthias Klumpp <matthias@tenstral.net>
+Date: Thu, 16 Nov 2023 00:59:15 +0100
+Subject: [PATCH] stemmer: Resolve potential issue where stemmer may never be
+ initialized
+
+If the initial locale was equal to the current stemming language, we may
+never have initialized the stemmer (which could lead to crashes or
+stemming being disabled).
+
+So we force the reload to always happen on initialization.
+CC: #558
+---
+ src/as-stemmer.c | 33 +++++++++++++++++++++------------
+ 1 file changed, 21 insertions(+), 12 deletions(-)
+
+diff --git a/src/as-stemmer.c b/src/as-stemmer.c
+index 63d45267..16ebd09b 100644
+--- a/src/as-stemmer.c
++++ b/src/as-stemmer.c
+@@ -47,6 +47,8 @@ G_DEFINE_TYPE (AsStemmer, as_stemmer, G_TYPE_OBJECT)
+ 
+ static gpointer as_stemmer_object = NULL;
+ 
++static void as_stemmer_reload_internal (AsStemmer *stemmer, const gchar *locale, gboolean force);
++
+ /**
+  * as_stemmer_finalize:
+  **/
+@@ -76,21 +78,14 @@ as_stemmer_init (AsStemmer *stemmer)
+ 
+ 	/* we don't use the locale in XML, so it can be POSIX */
+ 	locale = as_get_current_locale_posix ();
+-	stemmer->current_lang = as_utils_locale_to_language (locale);
+ 
+-	as_stemmer_reload (stemmer, stemmer->current_lang);
++	/* force a reload for initialization */
++	as_stemmer_reload_internal (stemmer, locale, TRUE);
+ #endif
+ }
+ 
+-/**
+- * as_stemmer_reload:
+- * @stemmer: A #AsStemmer
+- * @locale: The stemming language as POSIX locale.
+- *
+- * Allows realoading the #AsStemmer with a different language.
+- */
+-void
+-as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
++static void
++as_stemmer_reload_internal (AsStemmer *stemmer, const gchar *locale, gboolean force)
+ {
+ #ifdef HAVE_STEMMING
+ 	g_autofree gchar *lang = NULL;
+@@ -99,7 +94,7 @@ as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
+ 	/* check if we need to reload */
+ 	lang = as_utils_locale_to_language (locale);
+ 	locker = g_mutex_locker_new (&stemmer->mutex);
+-	if (as_str_equal0 (lang, stemmer->current_lang)) {
++	if (!force && as_str_equal0 (lang, stemmer->current_lang)) {
+ 		g_mutex_locker_free (locker);
+ 		return;
+ 	}
+@@ -119,6 +114,20 @@ as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
+ #endif
+ }
+ 
++/**
++ * as_stemmer_reload:
++ * @stemmer: A #AsStemmer
++ * @locale: The stemming language as POSIX locale.
++ *
++ * Allows realoading the #AsStemmer with a different language.
++ * Does nothing if the stemmer is already using the selected language.
++ */
++void
++as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
++{
++	as_stemmer_reload_internal (stemmer, locale, FALSE);
++}
++
+ /**
+  * as_stemmer_stem:
+  * @stemmer: A #AsStemmer
+-- 
+2.41.0
+

base-commit: 1cc3b7e80f60a2a5a6a1400ed0b025efeae7a523
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#67300] [PATCH gnome-team] gnu: appstream: Fix test.
  2023-11-15 23:12 [bug#67300] [PATCH gnome-team] gnu: appstream: Fix test Vivien Kraus via Guix-patches via
  2023-11-15 23:12 ` [bug#67300] [PATCH gnome-team v2] gnu: appstream: Load stemmer in all circumstances Vivien Kraus via Guix-patches via
@ 2023-11-20 19:48 ` Liliana Marie Prikler
  1 sibling, 0 replies; 4+ messages in thread
From: Liliana Marie Prikler @ 2023-11-20 19:48 UTC (permalink / raw)
  To: vivien, 67300; +Cc: rg, maxim.cournoyer

Am Donnerstag, dem 16.11.2023 um 00:12 +0100 schrieb Vivien Kraus:
> * gnu/packages/patches/appstream-load-stemmer-early.patch: New patch.
> * gnu/local.mk (dist_patch_DATA): Register it here.
> * gnu/packages/freedesktop.scm (appstream) [patches]: Use it here.
> [#:phases]<disable-failing-tests>: Remove.
> 
> Change-Id: Iddd6ce5887247df46f670c49f9efc66772c82ff0
> ---
This is not so much "Fix test" as it is "Load stemmer early".  

Still thanks.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#67300: [PATCH gnome-team v2] gnu: appstream: Load stemmer in all circumstances.
  2023-11-15 23:12 ` [bug#67300] [PATCH gnome-team v2] gnu: appstream: Load stemmer in all circumstances Vivien Kraus via Guix-patches via
@ 2023-11-23  8:07   ` Liliana Marie Prikler
  0 siblings, 0 replies; 4+ messages in thread
From: Liliana Marie Prikler @ 2023-11-23  8:07 UTC (permalink / raw)
  To: Vivien Kraus, 67300-done; +Cc: rg, maxim.cournoyer

Am Donnerstag, dem 16.11.2023 um 00:12 +0100 schrieb Vivien Kraus:
> If the default stemmer language is computed to be "en", such as in a
> Guix
> build container, then the stemmer will not be loaded.
> 
> * gnu/packages/patches/appstream-load-stemmer-early.patch: New patch.
> * gnu/local.mk (dist_patch_DATA): Register it here.
> * gnu/packages/freedesktop.scm (appstream) [patches]: Use it here.
> [#:phases]<disable-failing-tests>: Remove.
> 
> Change-Id: Iddd6ce5887247df46f670c49f9efc66772c82ff0
> ---
Pushed.

Thanks




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-23  8:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15 23:12 [bug#67300] [PATCH gnome-team] gnu: appstream: Fix test Vivien Kraus via Guix-patches via
2023-11-15 23:12 ` [bug#67300] [PATCH gnome-team v2] gnu: appstream: Load stemmer in all circumstances Vivien Kraus via Guix-patches via
2023-11-23  8:07   ` bug#67300: " Liliana Marie Prikler
2023-11-20 19:48 ` [bug#67300] [PATCH gnome-team] gnu: appstream: Fix test Liliana Marie Prikler

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.