From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SHEjD8wEQ2LlSQEAgWs5BA (envelope-from ) for ; Tue, 29 Mar 2022 15:08:28 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id eAaEDMwEQ2KgCAEA9RJhRA (envelope-from ) for ; Tue, 29 Mar 2022 15:08:28 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9BB6EA792 for ; Tue, 29 Mar 2022 15:08:27 +0200 (CEST) Received: from localhost ([::1]:51740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZBaE-0004JT-Rc for larch@yhetil.org; Tue, 29 Mar 2022 09:08:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZBWy-000231-5K for guix-patches@gnu.org; Tue, 29 Mar 2022 09:05:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38059) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nZBWx-0008Gk-Rk for guix-patches@gnu.org; Tue, 29 Mar 2022 09:05:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nZBWx-00057Q-6I for guix-patches@gnu.org; Tue, 29 Mar 2022 09:05:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54525] [patch v2 5/5] gnu: thunar: Add search path for "THUNARX_DIRS". Resent-From: tumashu@163.com Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Mar 2022 13:05:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54525 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54525@debbugs.gnu.org Cc: Feng Shu Received: via spool by 54525-submit@debbugs.gnu.org id=B54525.164855907119597 (code B ref 54525); Tue, 29 Mar 2022 13:05:03 +0000 Received: (at 54525) by debbugs.gnu.org; 29 Mar 2022 13:04:31 +0000 Received: from localhost ([127.0.0.1]:60183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZBWQ-000561-FX for submit@debbugs.gnu.org; Tue, 29 Mar 2022 09:04:31 -0400 Received: from m12-18.163.com ([220.181.12.18]:51005) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZBWM-000559-9O for 54525@debbugs.gnu.org; Tue, 29 Mar 2022 09:04:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=dgOFb yHhYNWRPE7yfrPkPPRHC6aiH2IwuP2EswAimUE=; b=c4hB2VXbnsfMY597puWDF tcs2no6+rn0sIXr6TlkMe6NanctoUya9pMWMgqCW0r0jwZiBRRsbkJKsJr5RnmnU aZYsWMvl6cZfQfQ5NR8pUT3Dr7T8Q2SB4KnewA5WEuBrMLOn/Qed3RK7MF54mlPd HcN970OABppdmUR+DzE5Q4= Received: from localhost.localdomain (unknown [117.92.30.200]) by smtp14 (Coremail) with SMTP id EsCowACHgQDEA0Ni1EciAA--.2550S6; Tue, 29 Mar 2022 21:04:17 +0800 (CST) From: tumashu@163.com Date: Tue, 29 Mar 2022 21:04:02 +0800 Message-Id: <20220329130402.26022-5-tumashu@163.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220329130402.26022-1-tumashu@163.com> References: <20220329130402.26022-1-tumashu@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CM-TRANSID: EsCowACHgQDEA0Ni1EciAA--.2550S6 X-Coremail-Antispam: 1Uf129KBjvJXoW3tFWkZF1rXr1xtr1kuFW3ZFb_yoWDWFWxpr 4rCryYq3y8Wr4kJa93Za1UXF15C348XF4Y93WfG3Waywn8Wry5uayxtr45Ar17ur4Ut3Wa grWaqw1UWFy5JFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UnSdkUUUUU= X-Originating-IP: [117.92.30.200] X-CM-SenderInfo: 5wxpt2lkx6il2tof0z/1tbiLxHS1FUMbuimmQAAsY 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: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648559307; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=dgOFbyHhYNWRPE7yfrPkPPRHC6aiH2IwuP2EswAimUE=; b=gDoj/bdExRTTcl/GhrQhod+zzhOHepr5doTP6waegcij7/5DmM8mnKCGT97xgFGAXU2UaV qwv3RwYwWY7DrT8QfJJo6BMz+CLvuv3UPgeAX6tC9R1GKfo0aVEV/hs2NaZi7InflXGdnX cq9yZCYUGuak6xw0WTpaRmvK7ZhSSrkidN2qnbZM0KG1UZzxIcNlD5W9lw/t00CG5mDUmZ TxAyTw+vvPF7PxSBXk75tS1vVs9gUZSUrQSPQexvpFhYlIOr5bVWnqZszfeN6C1HK75IDJ c5OEuP5EYuh+tDYydaQJkNiJ1u4LdPKzmcK/TyS7aPDCJuCxzg8EKSFx1mrHMQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648559307; a=rsa-sha256; cv=none; b=cCTcckfceafOhjbwle1+cJQ7Fdkbi8PoVgYHfX7RVAqHEInTL51L1cPgsULIqDfGoLjB0P VDcpu5XZh2b99r9NToQLnF0prWXEINfv14DbBmzUoljvTdDWqHIOJm3Qv4fyQcHAMnxueA hF3P3x3Exjig1p4Rm+PtkPccwuyKrQmuBytaSy4dtTukzTnd6d0ZugKIgQLBxArGrwJEF+ /sJU2uy8hL+cWykomTS6oTHdPiK6HGThmfqDd0P1xwb8ZmEhZt1eiF5cm/wmnTj1cEBjZh lV2U7iPP2rwmYMR1OY8Po9wefcEg1b5bYmF5UcVyzYacAfl3DK3g3O3EOsHpBQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=163.com header.s=s110527 header.b=c4hB2VXb; dmarc=fail reason="SPF not aligned (relaxed)" header.from=163.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 6.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=163.com header.s=s110527 header.b=c4hB2VXb; dmarc=fail reason="SPF not aligned (relaxed)" header.from=163.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 9BB6EA792 X-Spam-Score: 6.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: QBtKM3wFww8D From: Feng Shu * gnu/packages/xfce.scm (thunar)[native-search-paths]: new field. [source]: Add thunar-search-paths.patch. * gnu/local.mk: Add thunar-search-paths.patch. --- gnu/local.mk | 1 + .../patches/thunar-search-paths.patch | 214 ++++++++++++++++++ gnu/packages/xfce.scm | 12 +- 3 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/thunar-search-paths.patch diff --git a/gnu/local.mk b/gnu/local.mk index a704161abc..f715ec564a 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1845,6 +1845,7 @@ dist_patch_DATA = \ %D%/packages/patches/texi2html-document-encoding.patch \ %D%/packages/patches/texi2html-i18n.patch \ %D%/packages/patches/thefuck-test-environ.patch \ + %D%/packages/patches/thunar-search-paths.patch \ %D%/packages/patches/tidy-CVE-2015-5522+5523.patch \ %D%/packages/patches/tinyxml-use-stl.patch \ %D%/packages/patches/tipp10-disable-downloader.patch \ diff --git a/gnu/packages/patches/thunar-search-paths.patch b/gnu/packages/patches/thunar-search-paths.patch new file mode 100644 index 0000000000..31f54cbdc0 --- /dev/null +++ b/gnu/packages/patches/thunar-search-paths.patch @@ -0,0 +1,214 @@ +From 848f1dfb2d2f404efa5371817285236d33b32a5c Mon Sep 17 00:00:00 2001 +From: tumashu +Date: Tue, 22 Mar 2022 20:16:19 +0000 +Subject: [PATCH] Look for thunar plugins at $THUNARX_DIRS (Issue #748) + +THUNARX_DIRS is a list of directories where thunar plugins are looked for. It +is needed for distributions like NixOS or Guix System that do not install all +plugins in the same directory. In NixOS or Guix System each package is +installed in a self contained directory. + +This patch has been merged into thunar master: +1. Issue: https://gitlab.xfce.org/xfce/thunar/-/issues/748 +2. Merge Request: https://gitlab.xfce.org/xfce/thunar/-/merge_requests/197 + +--- + thunarx/thunarx-provider-factory.c | 86 +++++++++++++++++------------- + thunarx/thunarx-provider-module.c | 68 ++++++++++++++--------- + 2 files changed, 91 insertions(+), 63 deletions(-) + +diff --git a/thunarx/thunarx-provider-factory.c b/thunarx/thunarx-provider-factory.c +index 94b11545..386c3417 100644 +--- a/thunarx/thunarx-provider-factory.c ++++ b/thunarx/thunarx-provider-factory.c +@@ -154,54 +154,66 @@ thunarx_provider_factory_load_modules (ThunarxProviderFactory *factory) + GList *modules = NULL; + GList *lp; + GDir *dp; ++ gchar *dirs_string; ++ gchar **dirs; + +- dp = g_dir_open (THUNARX_DIRECTORY, 0, NULL); +- if (G_LIKELY (dp != NULL)) ++ dirs_string = (gchar *) g_getenv ("THUNARX_DIRS"); ++ if (!dirs_string) ++ dirs_string = THUNARX_DIRECTORY; ++ dirs = g_strsplit (dirs_string, G_SEARCHPATH_SEPARATOR_S, 0); ++ ++ for (int i = 0; dirs[i] != NULL; i++) + { +- /* determine the types for all existing plugins */ +- for (;;) +- { +- /* read the next entry from the directory */ +- name = g_dir_read_name (dp); +- if (G_UNLIKELY (name == NULL)) +- break; + +- /* check if this is a valid plugin file */ +- if (g_str_has_suffix (name, "." G_MODULE_SUFFIX)) +- { +- /* check if we already have that module */ +- for (lp = thunarx_provider_modules; lp != NULL; lp = lp->next) +- if (g_str_equal (G_TYPE_MODULE (lp->data)->name, name)) +- break; ++ dp = g_dir_open (dirs[i], 0, NULL); + +- /* use or allocate a new module for the file */ +- if (G_UNLIKELY (lp != NULL)) +- { +- /* just use the existing module */ +- module = THUNARX_PROVIDER_MODULE (lp->data); +- } +- else +- { +- /* allocate the new module and add it to our list */ +- module = thunarx_provider_module_new (name); +- thunarx_provider_modules = g_list_prepend (thunarx_provider_modules, module); +- } ++ if (G_LIKELY (dp != NULL)) ++ { ++ /* determine the types for all existing plugins */ ++ for (;;) ++ { ++ /* read the next entry from the directory */ ++ name = g_dir_read_name (dp); ++ if (G_UNLIKELY (name == NULL)) ++ break; + +- /* try to load the module */ +- if (g_type_module_use (G_TYPE_MODULE (module))) ++ /* check if this is a valid plugin file */ ++ if (g_str_has_suffix (name, "." G_MODULE_SUFFIX)) + { +- /* add the types provided by the module */ +- thunarx_provider_factory_add (factory, module); +- +- /* add the module to our list */ +- modules = g_list_prepend (modules, module); ++ /* check if we already have that module */ ++ for (lp = thunarx_provider_modules; lp != NULL; lp = lp->next) ++ if (g_str_equal (G_TYPE_MODULE (lp->data)->name, name)) ++ break; ++ ++ /* use or allocate a new module for the file */ ++ if (G_UNLIKELY (lp != NULL)) ++ { ++ continue; ++ } ++ else ++ { ++ /* allocate the new module and add it to our list */ ++ module = thunarx_provider_module_new (name); ++ thunarx_provider_modules = g_list_prepend (thunarx_provider_modules, module); ++ } ++ ++ /* try to load the module */ ++ if (g_type_module_use (G_TYPE_MODULE (module))) ++ { ++ /* add the types provided by the module */ ++ thunarx_provider_factory_add (factory, module); ++ ++ /* add the module to our list */ ++ modules = g_list_prepend (modules, module); ++ } + } + } +- } + +- g_dir_close (dp); ++ g_dir_close (dp); ++ } + } + ++ g_strfreev (dirs); + return modules; + } + +diff --git a/thunarx/thunarx-provider-module.c b/thunarx/thunarx-provider-module.c +index 023ad2ae..5ddf38b2 100644 +--- a/thunarx/thunarx-provider-module.c ++++ b/thunarx/thunarx-provider-module.c +@@ -175,37 +175,53 @@ thunarx_provider_module_load (GTypeModule *type_module) + { + ThunarxProviderModule *module = THUNARX_PROVIDER_MODULE (type_module); + gchar *path; ++ gchar *dirs_string; ++ gchar **dirs; ++ gboolean found; + +- /* load the module using the runtime link editor */ +- path = g_build_filename (THUNARX_DIRECTORY, type_module->name, NULL); +- module->library = g_module_open (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); +- g_free (path); ++ dirs_string = (gchar *) g_getenv ("THUNARX_DIRS"); ++ if (!dirs_string) ++ dirs_string = THUNARX_DIRECTORY; ++ dirs = g_strsplit (dirs_string, G_SEARCHPATH_SEPARATOR_S, 0); + +- /* check if the load operation was successfull */ +- if (G_UNLIKELY (module->library == NULL)) +- { +- g_printerr ("Thunar :Failed to load plugin `%s': %s\n", type_module->name, g_module_error ()); +- return FALSE; +- } ++ found = FALSE; + +- /* verify that all required public symbols are present in the plugin's symbol table */ +- if (!g_module_symbol (module->library, "thunar_extension_shutdown", (gpointer) &module->shutdown) +- || !g_module_symbol (module->library, "thunar_extension_initialize", (gpointer) &module->initialize) +- || !g_module_symbol (module->library, "thunar_extension_list_types", (gpointer) &module->list_types)) ++ for (int i = 0; !found && dirs[i] != NULL; i++) + { +- g_printerr ("Thunar :Plugin `%s' lacks required symbols.\n", type_module->name); +- g_module_close (module->library); +- return FALSE; ++ /* load the module using the runtime link editor */ ++ path = g_build_filename (dirs[i], type_module->name, NULL); ++ ++ module->library = g_module_open (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); ++ g_free (path); ++ ++ /* check if the load operation was successfull */ ++ if (G_UNLIKELY (module->library == NULL)) ++ { ++ g_printerr ("Thunar :Failed to load plugin `%s' from `%s': %s\n", type_module->name, path, g_module_error ()); ++ continue; ++ } ++ ++ /* verify that all required public symbols are present in the plugin's symbol table */ ++ if (!g_module_symbol (module->library, "thunar_extension_shutdown", (gpointer) &module->shutdown) ++ || !g_module_symbol (module->library, "thunar_extension_initialize", (gpointer) &module->initialize) ++ || !g_module_symbol (module->library, "thunar_extension_list_types", (gpointer) &module->list_types)) ++ { ++ g_printerr ("Thunar :Plugin `%s' in `%s' lacks required symbols.\n", type_module->name, path); ++ g_module_close (module->library); ++ continue; ++ } ++ ++ /* initialize the plugin */ ++ (*module->initialize) (module); ++ ++ /* ensure that the module will never be unloaded if it requests to be kept in memory */ ++ if (G_UNLIKELY (module->resident)) ++ g_module_make_resident (module->library); ++ ++ found = TRUE; + } +- +- /* initialize the plugin */ +- (*module->initialize) (module); +- +- /* ensure that the module will never be unloaded if it requests to be kept in memory */ +- if (G_UNLIKELY (module->resident)) +- g_module_make_resident (module->library); +- +- return TRUE; ++ g_strfreev (dirs); ++ return found; + } + + +-- +2.34.0 + diff --git a/gnu/packages/xfce.scm b/gnu/packages/xfce.scm index 182fe0fd8f..d3b3026d14 100644 --- a/gnu/packages/xfce.scm +++ b/gnu/packages/xfce.scm @@ -16,6 +16,7 @@ ;;; Copyright © 2020, 2021, 2022 Michael Rohleder ;;; Copyright © 2021 Brendan Tildesley ;;; Copyright © 2021 André A. Gomes +;;; Copyright © 2022 Feng Shu ;;; ;;; This file is part of GNU Guix. ;;; @@ -747,7 +748,12 @@ (define-public thunar "thunar-" version ".tar.bz2")) (sha256 (base32 - "14lwi4ax0wj77980kkfhdf18b97339b17y8qc8gl2365mgswh1gi")))) + "14lwi4ax0wj77980kkfhdf18b97339b17y8qc8gl2365mgswh1gi")) + (patches + (search-patches + ;; NOTE: This patch is backported from thunar.git, it should + ;; be removed when update to thunar-4.18. + "thunar-search-paths.patch")))) (build-system gnu-build-system) (native-inputs (list pkg-config intltool)) @@ -762,6 +768,10 @@ (define-public thunar pcre xfce4-panel startup-notification)) + (native-search-paths + (list (search-path-specification + (variable "THUNARX_DIRS") + (files (list "lib/thunarx-3"))))) (home-page "https://www.xfce.org/") (synopsis "Xfce file manager") (description -- 2.34.0