From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CHq9EMLDfGPS3QAAbAwnHQ (envelope-from ) for ; Tue, 22 Nov 2022 13:42:42 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 8Bi/D8LDfGNKMgEAG6o9tA (envelope-from ) for ; Tue, 22 Nov 2022 13:42:42 +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 B4F4B2CF7E for ; Tue, 22 Nov 2022 13:42:41 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxSbi-0002x4-K8; Tue, 22 Nov 2022 07:42:35 -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 1oxMN4-0007pU-M9 for bug-guix@gnu.org; Tue, 22 Nov 2022 01:03:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxMN4-0002xt-6i for bug-guix@gnu.org; Tue, 22 Nov 2022 01:03:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oxMN4-0005Jq-21 for bug-guix@gnu.org; Tue, 22 Nov 2022 01:03:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#59474: Guix Home generated .profile sets XDG_ vars that break GDM+Gnome login on foreign distros Resent-From: Matt Armstrong Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 22 Nov 2022 06:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59474 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 59474@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166909694520385 (code B ref -1); Tue, 22 Nov 2022 06:03:01 +0000 Received: (at submit) by debbugs.gnu.org; 22 Nov 2022 06:02:25 +0000 Received: from localhost ([127.0.0.1]:49458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxMMS-0005Ij-Ur for submit@debbugs.gnu.org; Tue, 22 Nov 2022 01:02:25 -0500 Received: from lists.gnu.org ([209.51.188.17]:45678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxMMN-0005IX-UD for submit@debbugs.gnu.org; Tue, 22 Nov 2022 01:02:23 -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 1oxMMN-0007e2-MW for bug-guix@gnu.org; Tue, 22 Nov 2022 01:02:19 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxMML-0002ks-4d for bug-guix@gnu.org; Tue, 22 Nov 2022 01:02:19 -0500 Received: (Authenticated sender: matt@rfc20.org) by mail.gandi.net (Postfix) with ESMTPSA id 456EBE000A for ; Tue, 22 Nov 2022 06:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rfc20.org; s=gm1; t=1669096931; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=dWfNBaI7QXaBCfeO7y7XUnWqr+kEPvdfai+ldKEMXZY=; b=R1jSBTE23oBLTTwpRvkr3fludl63WdG2Dy46QwrNAqOaiUqC9uuC+toDYI0fCBA7vyW72H l5ogg7++KflM1dFQIiXC063CNUEFuJdikZ5f84AYmNWgyhARvdq/Cpiu9uJTNbzT27sXnG e40HwwNz6RZn5uGPD9HGmxlBkpYjggPQGewlGpPaleNsI6Wi88KoHjJu9rgwW8I9oKps3K c7CRgF3g53bPU3q3krlKh5rJph77x8YmJNB9zWJbDeTclHg+FlJ5SPjJ30KGuMhgysUTRL tVYPSDaH4Jlt5f+F4MsKMdEbc7pfrY6Lm14NLLOfBfC4gISeiuf4wqrgfJv4hg== Received: by mac-mini.lan (Postfix) with ESMTPS id 22C6F3A361 for ; Mon, 21 Nov 2022 22:02:08 -0800 (PST) Received: by naz.lan (Postfix, from userid 1000) id 019C643BF200; Mon, 21 Nov 2022 22:02:07 -0800 (PST) From: Matt Armstrong Date: Mon, 21 Nov 2022 22:02:07 -0800 Message-ID: <87fsebbk80.fsf@rfc20.org> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=217.70.183.196; envelope-from=matt@rfc20.org; helo=relay4-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Tue, 22 Nov 2022 07:42:32 -0500 X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1669120962; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=dWfNBaI7QXaBCfeO7y7XUnWqr+kEPvdfai+ldKEMXZY=; b=uvaYJ9J/XLwnb+DCpskRIxo3qgFV6L7osoa0c+n9Kt5xLPEbzeLDlW4lGVN0Pf7Ujk+01J WAFZAduk/0BNl6bGFtcfUvK0TOdaAI+/MLsjGEcyVJJTgjGFRYO6gGS25JsoCkfVGvyJSO hfjACWiacYODzy+TqnCrvrwA/PfIXRfuybhhoVufT/Eu1IkxwORQ1wCgy2vccSGfjsNf+a ja5LrKRMq6Q/8/JNVxjTEe8DfSm95HPgnTeBldBy2oBg/Oy9P+AcWgyIVqVMyjRE37ON8d AtlW8diVkPLAZUolMwbR6LXOpFbgJ6x7/+AuKp+dsZ3knVBffzgJBiNOePeC/g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1669120962; a=rsa-sha256; cv=none; b=AESsbAyT+vn6osSoWpaJ5uirc37ufLs0qf8mBBOiUsJ3/sfOdKKwWMQks4Y03hOTJAritQ 0Mr8EVAK3zCuN3fJH1iIAcu4fAaub4vsDIYuSn4UX0dXhoGaMpn6vh9FOQn824q60+VRY5 iZVXS4GCOVqcQxzlMVb2Qk8ql1YxHCxp/oKJuUWw8ZHZf7MePP5j2nJvlDJUgdRYAfnqdP LJYW8BaDmTx5n6KY2atOVoDRWENfYmbB5FMYpkeMIxL3bV30P0BzhgQwTP11mXbFmxzTiH z61GSPX4T4MGjrqu/7YjE6KTCdy6QtYELrP3V7DSEeYyy1FRcKNdt2FdT9aSYQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=rfc20.org header.s=gm1 header.b=R1jSBTE2; dmarc=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: 0.70 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=rfc20.org header.s=gm1 header.b=R1jSBTE2; dmarc=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: B4F4B2CF7E X-Spam-Score: 0.70 X-Migadu-Scanner: scn1.migadu.com X-TUID: M2rfJpSA4zBB I am experimenting with Guix Home on Debian Testing, using GDM+Gnome. The .profile generated by "guix home reconfigure" broke logging in to the Gnome desktop. The gnome session would die, failing to initialize what it considered to be essential things, and return to the login screen I could log in to a tty, and was able to undo the new .profile and get back to a working system. The home-configuration.scm I used was generated by "guix home import" and was quite simple: ---------------------------------------------------------------------- (use-modules (gnu home) (gnu packages) (gnu services) (guix gexp) (gnu home services shells)) (home-environment ;; Below is the list of packages that will show up in your ;; Home profile, under ~/.guix-home/profile. (packages (specifications->packages (list "glibc-locales"))) ;; Below is the list of Home services. To search for available ;; services, run 'guix home search KEYWORD' in a terminal. (services (list (service home-bash-service-type (home-bash-configuration (aliases '(("ls" . "ls --color=auto"))) (bashrc (list (local-file ".bashrc" "bashrc"))) (bash-logout (list (local-file ".bash_logout" "bash_logout")))))))) ---------------------------------------------------------------------- Note: a stock GDM+Gnome setup runs the user's login shell when logging in via the GDM display manager, and this shell execs gnome-session-binary. This doesn't necessarily happen with other display managers or other desktop environments, so on those systems the Guix Home .profile may not even run before the DE is initialized. Nearly all of my time debugging this was spent figuring this out! :-) The .profile file generated by Guix Home is this: ---------------------------------------------------------------------- HOME_ENVIRONMENT=$HOME/.guix-home . $HOME_ENVIRONMENT/setup-environment $HOME_ENVIRONMENT/on-first-login ---------------------------------------------------------------------- The first thing I see is that $HOME/.guix-home/seutp-environment is modifying various XDG_ variables incorrectly. It prepends new values without honor the variable's default value if it doesn't happen to be set already. For example, if XDG_DATA_DIRS is not set its default value is "/usr/local/share/:/usr/share/". But .guix-home/setup-environment will instead prepend a value without checking, leaving XDG_DATA_DIRS set incorrectly to "$HOME/.guix-home/profile/share:" when it should be "$HOME/.guix-home/profile/share:/usr/local/share/:/usr/share/". See this code in setup-environment: case $XDG_DATA_DIRS in *$HOME_ENVIRONMENT/profile/share*) ;; *) export XDG_DATA_DIRS=$HOME_ENVIRONMENT/profile/share:$XDG_DATA_DIRS ;; esac The correct idiom is this: XDG_DATA_DIRS=PATH_TO_PREPEND:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/} or XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}:PATH_TO_APPEND The above is what I see in various Nix and Snap configuration files. Because I have a few other things installed that modify XDG_DATA_DIRS before Guix Home does, Guix Home doesn't break that particular variable. It did break XDG_CONFIG_DIRS, since Guix Home was setting it to "$HOME/.guix-home/profile/etc/xdg:". I worked around this problem by running this code before Guix Home's .profile: # Note: when XDG_CONFIG_DIRS is not set Guix home sets # XDG_CONFIG_DIRS="$HOME/.guix-home/profile/etc/xdg:", which removes # the default "/etc/xdg" value. if [[ -z $XDG_CONFIG_DIRS ]]; then XDG_CONFIG_DIRS=/etc/xdg fi # Note: when XDG_DATA_DIRS is not set Guix home sets # XDG_DATA_DIRS="$HOME/.guix-home/profile/share:", which removes the # default "/usr/local/share:/usr/share" value. if [[ -z $XDG_DATA_DIRS ]]; then XDG_DATA_DIRS="/usr/local/share:/usr/share" fi I have other more minor quibbles about how Guix Home handles XDG values: XDG_STATE_HOME is set to a non-standard value. In the current XDG Base Directory Specification it defaults to "$HOME/.local/state", but Guix Home sets it to "$HOME/.local/var/lib". On a foreign distro this is going to cause some disruption when a user switches to Guix Home, or switches away. XDG_LOG_HOME is a non-standard variable. The spec suggests that logs should go in XDG_STATE_HOME. Why not a establish a GUIX_LOG_HOME variable instead? (if it ever does become a standard XDG variable, its default may not be the same one picked by Guix Home, causing the same issue as above). Setting XDG_RUNTIME_DIR is not something I would expect Guix Home to do -- it is the job of whatever logs the user in. XDG_CACHE_HOME, XDG_CONFIG_HOME, XDG_DATA_HOME are set to their defaults unnecessarily. I modified my personal config by unsetting XDG_STATE_HOME, XDG_LOG_HOME, XDG_CACHE_HOME, XDG_CONFIG_HOME, and XDG_DATA_HOME if Guix Home left them set to their default values (in the case of XDG_STATE_HOME I unset it unconditionally).