From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2Oa/OqZEOmLK8QAAgWs5BA (envelope-from ) for ; Tue, 22 Mar 2022 22:50:30 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id uMlPM6ZEOmI5BgAAG6o9tA (envelope-from ) for ; Tue, 22 Mar 2022 22:50:30 +0100 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 6C9EAAB98 for ; Tue, 22 Mar 2022 22:50:30 +0100 (CET) Received: from localhost ([::1]:59888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWlZA-0004WB-68 for larch@yhetil.org; Tue, 22 Mar 2022 16:57:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWlT6-0000PX-Mu for bug-guix@gnu.org; Tue, 22 Mar 2022 16:51:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWlT6-0007cT-DH for bug-guix@gnu.org; Tue, 22 Mar 2022 16:51:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nWlT6-0002V7-Be for bug-guix@gnu.org; Tue, 22 Mar 2022 16:51:04 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#54525: [PATCH 5/5] gnu: thunar: Add search path for "THUNARX_DIRS". Resent-From: tumashu@163.com Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 22 Mar 2022 20:51:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54525 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: 54525@debbugs.gnu.org Received: via spool by 54525-submit@debbugs.gnu.org id=B54525.16479822169504 (code B ref 54525); Tue, 22 Mar 2022 20:51:04 +0000 Received: (at 54525) by debbugs.gnu.org; 22 Mar 2022 20:50:16 +0000 Received: from localhost ([127.0.0.1]:41967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWlSJ-0002TB-88 for submit@debbugs.gnu.org; Tue, 22 Mar 2022 16:50:16 -0400 Received: from m12-12.163.com ([220.181.12.12]:50761) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWlSG-0002Sa-S9 for 54525@debbugs.gnu.org; Tue, 22 Mar 2022 16:50:14 -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=gyWku DD74gWNZYhKNC7pi4flAL0+qYdd6x8RqLrDbL4=; b=law2txUYmGuIJOKfgFnIA 5iyr56wT+pUMMj2rM2+IPd2kmzhP+cTqvo8XZD91Uu5e/HbOYupWNtIAUJV5xNtW oIQ473S0fXfEso84TnQ+mSuTSNL1SwhzD++U8ctZdpBDE+3yclwVZJrHv/DofNFr ts4cYkQEY8E+WxOdOjsAtg= Received: from localhost.localdomain (unknown [117.92.162.81]) by smtp8 (Coremail) with SMTP id DMCowAAXZo5pNjpigBBSBg--.56855S6; Wed, 23 Mar 2022 04:50:06 +0800 (CST) From: tumashu@163.com Date: Wed, 23 Mar 2022 04:49:42 +0800 Message-Id: <20220322204942.9624-5-tumashu@163.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220322204942.9624-1-tumashu@163.com> References: <20220322204942.9624-1-tumashu@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CM-TRANSID: DMCowAAXZo5pNjpigBBSBg--.56855S6 X-Coremail-Antispam: 1Uf129KBjvJXoW3Gr4fGrWUuw4ktr45Kw4kZwb_yoWfZFyxpF 4rCry5XrW8Wrs7Ja93Za18XF15Cry8WF4Y93WfW3Waywn8Wry5uay7trWYyr17ur4Ut3Wa grWaqw17Wry5JrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UFfO7UUUUU= X-Originating-IP: [117.92.162.81] X-CM-SenderInfo: 5wxpt2lkx6il2tof0z/xtbB3wbL1GBHIHqVKwAAsF X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Tue, 22 Mar 2022 16:56:56 -0400 X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Feng Shu Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" 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=1647985830; 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=gyWkuDD74gWNZYhKNC7pi4flAL0+qYdd6x8RqLrDbL4=; b=SfVJaOS23KdgnzyAO45+sjlHDlN/+lfTeulsu4I5af1QJGvuU9UD+PrkO9u3QWdOfOZUij zslzLuRevYeuxX1SxNeuAMJRt9HmyW/eS2mkYa6WgJ167JEGuxan32gtKzDGqnRjFDjBo1 DszvhNLhQDsQh397knBUNj23ydeUCNFQqYVaAA5qRH3L833VWUqFtLVL2Rn+OfQydw+1QL ZNYtf/JtD9+Dgc3PBZFzuAg5Dh8txNLSloFPdS2mj1yFRCtItm/1XwnBXuNoptVfHuyFGQ eCTfkeHsMe7MGdmTf8UaDuc/MvZC5fvcfjfiy74i2DSwUtURBgqOeYYcWe4tDg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647985830; a=rsa-sha256; cv=none; b=tHhVzLXhJvK4u8GVOgWPDWKRw+ANuZkwscaDCOvPY7xqmJBbZfA1IYeGDqefCYTUgk9Hj8 uZi2zWtKSY6E4TxulfDnSo1vbSFhZeHvXDxSE+8H5KmjaLg6tcrZBKbIoDyWUMK2AFu/cI ciBeH7hWP663bKHA5gHIe3Tz1wl4GK2ew0imSCWd3pIlLPzpGsiojQGoe27i7hOXPgOt2i CiVjThn5f790sVzDiI6QXoDdPBAXT1q/sTKUyrIDUwNw36n7AQIEStVLm5l/8axea6VSfF aHoXiDbdVzyaaaCuKe1Cbeg8bYQAJiX8m6ihS5a1LUNFaTL93Ih8UWcwc1rahQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=163.com header.s=s110527 header.b=law2txUY; dmarc=fail reason="SPF not aligned (relaxed)" header.from=163.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 6.89 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=163.com header.s=s110527 header.b=law2txUY; dmarc=fail reason="SPF not aligned (relaxed)" header.from=163.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 6C9EAAB98 X-Spam-Score: 6.89 X-Migadu-Scanner: scn1.migadu.com X-TUID: 7+AsZVDm0lLb From: Feng Shu * gnu/packages/xfce.scm (thunar)[native-search-paths]: new field. [source]: Add thunar-search-paths.patch. --- .../patches/thunar-search-paths.patch | 211 ++++++++++++++++++ gnu/packages/xfce.scm | 12 +- 2 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/thunar-search-paths.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..fcf55ba14f --- /dev/null +++ b/gnu/packages/patches/thunar-search-paths.patch @@ -0,0 +1,211 @@ +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/GuixOS that do not +install all plugins in the same directory. In NixOS/GuixOS each +package is installed in a self contained directory. + +MR !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 d3a414ec15..bdeb1e9583 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