From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id mAZJGCueo1/9TAAA0tVLHw (envelope-from ) for ; Thu, 05 Nov 2020 06:39:39 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 0AYaFCueo19hcgAAbx9fmQ (envelope-from ) for ; Thu, 05 Nov 2020 06:39:39 +0000 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 B83579404C7 for ; Thu, 5 Nov 2020 06:39:38 +0000 (UTC) Received: from localhost ([::1]:45636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kaYvp-0000ig-2l for larch@yhetil.org; Thu, 05 Nov 2020 01:39:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaYvG-0000i6-IP for bug-guix@gnu.org; Thu, 05 Nov 2020 01:39:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39889) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kaYvG-0006Kx-9J for bug-guix@gnu.org; Thu, 05 Nov 2020 01:39:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kaYvG-000598-64 for bug-guix@gnu.org; Thu, 05 Nov 2020 01:39:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#36376: Application menu of desktop environment not automatically updated Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 05 Nov 2020 06:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36376 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 36376-submit@debbugs.gnu.org id=B36376.160455832419758 (code B ref 36376); Thu, 05 Nov 2020 06:39:02 +0000 Received: (at 36376) by debbugs.gnu.org; 5 Nov 2020 06:38:44 +0000 Received: from localhost ([127.0.0.1]:51435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kaYuy-00058b-15 for submit@debbugs.gnu.org; Thu, 05 Nov 2020 01:38:44 -0500 Received: from mail-qk1-f182.google.com ([209.85.222.182]:43375) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kaYut-00058H-5K for 36376@debbugs.gnu.org; Thu, 05 Nov 2020 01:38:42 -0500 Received: by mail-qk1-f182.google.com with SMTP id c27so308288qko.10 for <36376@debbugs.gnu.org>; Wed, 04 Nov 2020 22:38:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=n5fHk39gePngqUMz7uj/aMa3LUtQUcmq+UKYxHAk3PE=; b=RaiGf/ggAqoFgmBYfuUYkAsuyXkQjryxJjiFS+RQXdfoXpGK4e7myo7/Shl5QeRK4+ btpOsBVgMgtiDdYE3/EfXFi6TKptJD+s7Awte9OBc2Krd5iKntbgXAlYds7HK/F0n9/5 /TsMZ09clLqykpR/INivD4xpDURg1bBx9YG7oKkLg9F4YhXAgltodmc1vUNyVWczSaGZ CBYx1/FmBJAX1nXihcxhdS8EzK0xygqQS7HhGrsvnG8UXZtICeOFvvDfHhQj36QfI3jv oY6gRPF9FQ2huJK792PsZPTCJFI8+w2EBkmpdMIg8MG2mobtjsOwvOQBtej1aj6PUzMQ WK1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=n5fHk39gePngqUMz7uj/aMa3LUtQUcmq+UKYxHAk3PE=; b=Y6AkoMeP9TFgmMDfllzuEUxj+igTb+J+8d2vthpyk1txg8/U+ermznWN9QsF7MVRm4 OEwp6QjMCOOOb05Pf4p5rHxvtQAGJqRykOydV5+080fUzm46NndNTYxn/GajdBq4ej2v F0H1yIgYFhteKLnDVpySYQLpIYq0+IrexC/TIMOIcSrUzvq2aWRG8/NXI7crqkQkbxgP Wosx84SAPeBnsvWa0QHFOjU5QFypBTLZBB0JLIJWKkQ1hY9eqK5NTcFoYAWDBLwc7GZY 0iMq34ddNOzfu4gH7YnOJB9Pt6n3sCaf83D2u/XtAuQJijCdlu13xk50XwABjbOGz5AR rPSg== X-Gm-Message-State: AOAM5311RwG269gx9UYsF/JUWXYKmHOETAJ+M/g0d/CHDs7nXX9GeV/C xA1xlp3gwzvVFX7utyuVX3g= X-Google-Smtp-Source: ABdhPJyE4x9XL8cShYDxFm7Niswmi3loiBrBSf6b8ebQATG1kQjPhvOEjtesSN7O5WSgxJuuXJcOGw== X-Received: by 2002:ae9:f444:: with SMTP id z4mr778696qkl.338.1604558313643; Wed, 04 Nov 2020 22:38:33 -0800 (PST) Received: from hurd (dsl-154-213.b2b2c.ca. [66.158.154.213]) by smtp.gmail.com with ESMTPSA id q1sm331069qti.95.2020.11.04.22.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2020 22:38:32 -0800 (PST) From: Maxim Cournoyer References: <871rzhn483.fsf@gnu.org> <87o8keawju.fsf@gnu.org> Date: Thu, 05 Nov 2020 01:38:25 -0500 In-Reply-To: <87o8keawju.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Tue, 03 Nov 2020 23:46:13 +0100") Message-ID: <87d00swboe.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leo Prikler , 36376@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=gmail.com header.s=20161025 header.b=RaiGf/gg; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: IMmcnKBAoj6s --=-=-= Content-Type: text/plain Hi Ludovic! > +static void > +guix_profile_changed (GFileMonitor *monitor, > + GFile *file, > + GFile *other_file, > + GFileMonitorEvent event_type, > + gpointer user_data) > +{ > + DesktopFileDir *dir = user_data; > + > + desktop_file_dir_reset (dir); > + > + /* When ~/.guix-profile changes, emit the 'changed' signal so everyone > + knows. */ > + g_app_info_monitor_fire (); > +} > + > static void > desktop_file_dir_changed (GFileMonitor *monitor, > GFile *file, > @@ -1531,6 +1548,7 @@ desktop_file_dirs_lock (void) > > if (desktop_file_dirs == NULL || desktop_file_dirs->len == 0) > { > + const gchar *home; > const char * const *dirs; > gint i; > > @@ -1555,6 +1573,27 @@ desktop_file_dirs_lock (void) > for (i = 0; dirs[i]; i++) > g_ptr_array_add (desktop_file_dirs, desktop_file_dir_new (dirs[i])); > > + home = g_get_home_dir (); > + if (guix_profile_monitor == NULL && home != NULL) > + { > + DesktopFileDir *dir; > + const gchar *profile, *data_dir; > + profile = g_build_filename (home, ".guix-profile", NULL); > + data_dir = g_build_filename (profile, "share", NULL); > + dir = desktop_file_dir_new (data_dir); > + > + /* Monitor ~/.guix-profile and treat modifications to > + ~/.guix-profile as if they were modifications to > + ~/.guix-profile/share. */ > + guix_profile_monitor = > + g_local_file_monitor_new_in_worker (profile, FALSE, G_FILE_MONITOR_NONE, > + guix_profile_changed, > + desktop_file_dir_ref (dir), > + closure_notify_cb, NULL); > + > + g_ptr_array_add (desktop_file_dirs, desktop_file_dir_ref (dir)); > + } > + > /* The list of directories will never change after this, unless > * g_get_user_config_dir() changes due to %G_TEST_OPTION_ISOLATE_DIRS. */ > desktop_file_dirs_config_dir = user_config_dir; I think the attached patch is an improvement over the above, by also supporting /run/current-system/share, being a bit simpler, and not adding extra monitors. I've reused the cool trick of passing FALSE to g_local_file_monitor_new_in_worker to force it to use its polling mode fallback. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=glib-appinfo-watch.patch Content-Transfer-Encoding: quoted-printable >From a79645c565e56ac201e66936d9f9883ad9387b06 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Thu, 5 Nov 2020 00:24:29 -0500 Subject: [PATCH] gdesktopappinfo: Fix monitoring of a Guix profile XDG_DATA_DIR. MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Fixes . Treat the $HOME/.guix-profile/share and /run/current-system/share XDG_DATA_DIRS file names specially so that the inotify-based monitors placed by GLib monitor their parent link rather than an immutable directory. Co-authored by Ludovic Court=C3=A8s <=C4=BCudo@gnu.org>. --- gio/gdesktopappinfo.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index f1e2fdd65..e659034d5 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -1380,7 +1380,8 @@ closure_notify_cb (gpointer data, static void desktop_file_dir_init (DesktopFileDir *dir) { - const gchar *watch_dir; + const gchar *watch_dir, *guix_profile_data, *system_profile_data; + gboolean is_directory =3D TRUE; =20 g_assert (!dir->is_setup); =20 @@ -1390,13 +1391,25 @@ desktop_file_dir_init (DesktopFileDir *dir) dir->alternatively_watching =3D desktop_file_dir_get_alternative_dir (di= r); watch_dir =3D dir->alternatively_watching ? dir->alternatively_watching = : dir->path; =20 + /* Workaround for Guix: watch the link of a profile, not its + * immutable 'share' sub-directory. */ + guix_profile_data =3D g_build_filename (g_get_home_dir (), ".guix-profil= e", "share", NULL); + system_profile_data =3D "/run/current-system/share"; + + if (g_str_equal (watch_dir, guix_profile_data) + || g_str_equal (watch_dir, system_profile_data)) + { + is_directory =3D FALSE; + watch_dir =3D g_path_get_dirname (watch_dir); + } + /* There is a very thin race here if the watch_dir has been _removed_ * between when we checked for it and when we establish the watch. * Removes probably don't happen in usual operation, and even if it * does (and we catch the unlikely race), the only degradation is that * we will fall back to polling. */ - dir->monitor =3D g_local_file_monitor_new_in_worker (watch_dir, TRUE, G_= FILE_MONITOR_NONE, + dir->monitor =3D g_local_file_monitor_new_in_worker (watch_dir, is_direc= tory, G_FILE_MONITOR_NONE, desktop_file_dir_chan= ged, desktop_file_dir_ref = (dir), closure_notify_cb, NU= LL); --=20 2.28.0 --=-=-= Content-Type: text/plain It's untested because 'guix vm' is taking more time to complete than I'm willing to wait for in the middle of the night :-). I'll try it tomorrow. Thanks, Maxim --=-=-=--