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 kIG5EePaoV/WFAAA0tVLHw (envelope-from ) for ; Tue, 03 Nov 2020 22:34:11 +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 UPBmDePaoV9zXAAAbx9fmQ (envelope-from ) for ; Tue, 03 Nov 2020 22:34:11 +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 AE39A94021E for ; Tue, 3 Nov 2020 22:34:10 +0000 (UTC) Received: from localhost ([::1]:58268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ka4sT-00029l-KZ for larch@yhetil.org; Tue, 03 Nov 2020 17:34:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ka4sM-00029d-TD for bug-guix@gnu.org; Tue, 03 Nov 2020 17:34:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ka4sM-0006w9-KB for bug-guix@gnu.org; Tue, 03 Nov 2020 17:34:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ka4sM-0001nT-HH for bug-guix@gnu.org; Tue, 03 Nov 2020 17:34:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#35594: GNOME: Application icons are not displayed immediately after installation Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 03 Nov 2020 22:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35594 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: sirgazil Received: via spool by 35594-submit@debbugs.gnu.org id=B35594.16044428066863 (code B ref 35594); Tue, 03 Nov 2020 22:34:02 +0000 Received: (at 35594) by debbugs.gnu.org; 3 Nov 2020 22:33:26 +0000 Received: from localhost ([127.0.0.1]:46712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ka4rm-0001md-En for submit@debbugs.gnu.org; Tue, 03 Nov 2020 17:33:26 -0500 Received: from mail-qv1-f67.google.com ([209.85.219.67]:40978) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ka4rl-0001mQ-MP for 35594@debbugs.gnu.org; Tue, 03 Nov 2020 17:33:26 -0500 Received: by mail-qv1-f67.google.com with SMTP id t20so8800184qvv.8 for <35594@debbugs.gnu.org>; Tue, 03 Nov 2020 14:33:25 -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=fLc3HbS0pcI0wtGAYODqF98nBLcPYyIhe95pN/8fYhg=; b=YM8yReWQMzGECedZuT1PJ4wFdtWjw4wklbwmGOBZdoSRctHR7wZUNpVFvZZXR02trF tyhKBmfkeERZ7OKy8rtgkUv3wsId9b0QGhiOoh4rQ4MvSukcfPTFpdGE3o0Otz47ybQX tldJZtfyts+uyGUr1Ymu40kzMemYOfrhgnYTRwWqaYr/ZoIyYZ+b4UDLcKDjREFNcU9o ZpIchkPvdK2kksYF7Kmxsl6Uzfd0/kX4RXiNiPFbUYK+xrXYh8b1jmEPbhGH05im4lBI 1owd1gWWlSQ+8xW7C5Wd84V7jy1VtHzLLraGuvicOLRsc/Zwv9ajAM90vuTnKiSzioQ5 gLpg== 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=fLc3HbS0pcI0wtGAYODqF98nBLcPYyIhe95pN/8fYhg=; b=AVzvnvVU+PjJgCFgODOE3dV6FGqDyJNioX9oa/Dq/h29cLSMQqvLD32Q8XCdUSWj6a 9h3SUgx7AAulav2W9GVrHib9/1gCyw8/tjQS7/7n8quKLj8adX7dd6yajvYtasemJHPs 3WmThsqZBhmYaBJdFAq06I9yDbXb0R2ziu/YmCZo8pecVKfDMkbaU38tF4RCxzmJACVV kh9JgGKXV2fuvG9oolwySsIszUKIpHBuSKlIeXo9G6FDcWufqz6wO42hVEgwZfc3RQNV 3fS1QwWcmAFPSDccY2F/CVQwlkZfLBmKYmQ7euDJ1PRJz+tATbAV+RHzQPy/tFyClOkc vqaw== X-Gm-Message-State: AOAM533eIYifqNpJaZqmhwWgT2KFkApljRpGh//gGpLZZQBR0MJh7SqN ZcKG988mHl6aFWF67BzoWK8q/TD19q4= X-Google-Smtp-Source: ABdhPJy17o2TFLv866J4TwbNOyI+Y9M5KUN/+5/1NtgkxdeuXB/GsHRFxIXoWZ61k1k/GlMTOIs86A== X-Received: by 2002:a0c:85e3:: with SMTP id o90mr27398818qva.46.1604442799896; Tue, 03 Nov 2020 14:33:19 -0800 (PST) Received: from hurd (dsl-236-123-206.b2b2c.ca. [207.236.123.206]) by smtp.gmail.com with ESMTPSA id 19sm159955qkf.93.2020.11.03.14.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 14:33:19 -0800 (PST) From: Maxim Cournoyer References: <16a8a4b4c07.ad1f7a9a40480.985002149086753257@zoho.com> <87eelaz65h.fsf@gmail.com> <87a6vyz20u.fsf@gmail.com> Date: Tue, 03 Nov 2020 17:33:18 -0500 In-Reply-To: <87a6vyz20u.fsf@gmail.com> (Maxim Cournoyer's message of "Tue, 03 Nov 2020 14:14:09 -0500") Message-ID: <875z6myssx.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 35594@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=YM8yReWQ; 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: xwa9RKW0aUAa Hi again, Maxim Cournoyer writes: > Hello, > > Maxim Cournoyer writes: > >> After asking in the #gnome channel on freenode, the problem is likely >> caused by GNOME Shell using inotify to watch the $XDG_DATA_DIRS >> referenced $HOME/.guix-profile/share/applications directory. The >> problem is that the inode of such directory will never change, as it >> points to the current profile under /gnu/store: >> >> $ ls -id $HOME/.guix-profile/share/applications >> 72653730 /home/maxim/.guix-profile/share/applications/ >> maxim@hurd ~/src/guix$ realpath $HOME/.guix-profile/share/applications >> /gnu/store/ph6a7fy735w5nycmf3za77m6v3g0r7xb-profile/share/applications >> maxim@hurd ~/src/guix$ ls -id /gnu/store/ph6a7fy735w5nycmf3za77m6v3g0r7xb-profile/share/applications >> 72653730 /gnu/store/ph6a7fy735w5nycmf3za77m6v3g0r7xb-profile/share/applications/ >> >> Any applications making use of inotify to discover changes (to plugins, >> for example) is at risk of having the same problem in Guix. >> >> I don't currently have an idea of how we can fix this. > > Watching of the directory is done via Glib's GAppInfoMonitor > (gpio/gdesktopappinfo.c). A suggested idea from #gnome-shell would be > to patch its desktop_file_dir_init() procedure with Guix-specifics; I > don't know *how* yet. The folks in #gtk may provide some clues. > > Maxim I've analyzed the situation a bit; I'll explain the big lines of what I think might be a solution. The idea would be to patch desktop_file_dir_init() as mentioned earlier with a procedure similar to desktop_file_dir_get_alternative_dir in that same gdesktopappinfo.c file. This new procedure would search for a parent symlink of the dir argument (dir being one of the entries constructed via XDG_DATA_DIRS, such as $HOME/.guix-profile/share/applications.). The algorithm for this new procedure would be like: 1. Check if a parent of DIR is a symlink. When there are none, return NULL. 2. Resolve the symlink parent until the last symlink, e.g. for symlink1 -> symlink2 -> directory, it saves symlink2. 3. Return the parent directory of the symlink resulting from 2 (i.e. dirname symlink2). In most cases (guix environment, build environment, extra user profiles), the entries in XDG_DATA_DIRS are not symlinks but directly store entries so there's nothing we can do about it. The case of interest here is the default user profile or $HOME/.guix-profile, which gets added to XDG_DATA_DIRS via /etc/profile (on Guix System). Because of the indirect links to the store, and the mutable /var/guix/profiles/per-user/$USER directory used to store the profile links, it is possible to have inotify work correctly. The algorithm described above would resolve $HOME/.guix-profile into /var/guix/profiles/per-user/$USER, and /run/current-system into /run. While adding a watch to /run is not optimal, it's not dramatic either given the watch is not recursive and only watch for specific actions: #define IP_INOTIFY_DIR_MASK (IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_DELETE|IN_CREATE|IN_DELETE_SELF|IN_UNMOUNT|IN_MOVE_SELF|IN_CLOSE_WRITE) (from gio/inotify/inotify-path.c) Thoughts? Thanks, Maxim