From patchwork Wed Nov 15 23:12:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivien Kraus X-Patchwork-Id: 56661 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D4DAA27BBEA; Mon, 20 Nov 2023 17:30:38 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 9B6C127BBE2 for ; Mon, 20 Nov 2023 17:30:37 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r586B-0003In-Ns; Mon, 20 Nov 2023 12:30:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5863-0003GB-4h for guix-patches@gnu.org; Mon, 20 Nov 2023 12:30:11 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r585x-0000eu-8Y for guix-patches@gnu.org; Mon, 20 Nov 2023 12:30:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r585y-0000Ug-S3 for guix-patches@gnu.org; Mon, 20 Nov 2023 12:30:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67300] [PATCH gnome-team] gnu: appstream: Fix test. Resent-From: Vivien Kraus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Nov 2023 17:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67300 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67300@debbugs.gnu.org Cc: rg@raghavgururajan.name, liliana.prikler@gmail.com, maxim.cournoyer@gmail.com X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17005013821796 (code B ref -1); Mon, 20 Nov 2023 17:30:02 +0000 Received: (at submit) by debbugs.gnu.org; 20 Nov 2023 17:29:42 +0000 Received: from localhost ([127.0.0.1]:54391 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r585d-0000Si-SY for submit@debbugs.gnu.org; Mon, 20 Nov 2023 12:29:42 -0500 Received: from lists.gnu.org ([2001:470:142::17]:46376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r585Z-0000Rx-0F for submit@debbugs.gnu.org; Mon, 20 Nov 2023 12:29:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r585R-00032l-1b for guix-patches@gnu.org; Mon, 20 Nov 2023 12:29:29 -0500 Received: from planete-kraus.eu ([89.234.140.182]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1r585P-0000b6-7u for guix-patches@gnu.org; Mon, 20 Nov 2023 12:29:28 -0500 Received: from planete-kraus.eu (localhost.lan [127.0.0.1]) by planete-kraus.eu (OpenSMTPD) with ESMTP id af04c219; Mon, 20 Nov 2023 17:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=planete-kraus.eu; h= message-id:from:date:subject:to:cc:mime-version; s=albinoniA; bh=31/yhG/34TLALmxoCddxmU/WW1g=; b=QzHixpvMA7xUahHvdwNpFHR3XbZU I5Aq2fIecGXIsDT496994siTR4JjNN0TNuFT4/HwTJZVMoxA02lT3m2RZaIXgA8g BMTYeXo7bUxw8gGS5qOIcuGG5WHiKG8tlOPm+VzF6rKstJSa6wVW8VC+fRKLDXla RYRegTVQ5qJ1cX1rPFb6/pzEO5ZzUYxtZ5Ua1txSQ+aSOgGWdmt0w22Q8oDviJfI Xke+R8rcG/r3retP5ctmxOO5PuALC95KwmS1WSeoLTsIxly45FteNjVy5TY/kURi 0CKoM1Pl/FC5z8D+lHwVZjQ9jcYF7KF5TQQayS3LvqlH5iO5zdVAzZtekw== Received: by planete-kraus.eu (OpenSMTPD) with ESMTPSA id e87d5ae5 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Mon, 20 Nov 2023 17:29:22 +0000 (UTC) Message-ID: <85eae89301e97317fb2f8576378890b3e8f29ac2.1700501299.git.vivien@planete-kraus.eu> Date: Thu, 16 Nov 2023 00:12:44 +0100 MIME-Version: 1.0 User-Agent: Evolution 3.46.4 Received-SPF: pass client-ip=89.234.140.182; envelope-from=vivien@planete-kraus.eu; helo=planete-kraus.eu X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Vivien Kraus X-ACL-Warn: , Vivien Kraus via Guix-patches X-Patchwork-Original-From: Vivien Kraus via Guix-patches via From: Vivien Kraus Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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]: 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 base-commit: 1cc3b7e80f60a2a5a6a1400ed0b025efeae7a523 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 +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 +