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 ms9.migadu.com with LMTPS id 0CJFExP6jWQe7AAASxT56A (envelope-from ) for ; Sat, 17 Jun 2023 20:23:15 +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 IA9UExP6jWR5aAAA9RJhRA (envelope-from ) for ; Sat, 17 Jun 2023 20:23:15 +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 51BF92DAA6 for ; Sat, 17 Jun 2023 20:23:14 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qAaZm-00021O-70; Sat, 17 Jun 2023 14:23:06 -0400 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 1qAaZj-00021F-HM for guix-patches@gnu.org; Sat, 17 Jun 2023 14:23:03 -0400 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 1qAaZj-00067a-9I for guix-patches@gnu.org; Sat, 17 Jun 2023 14:23:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qAaZi-0004aW-Jj for guix-patches@gnu.org; Sat, 17 Jun 2023 14:23:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#61982] [PATCH 2/2] home: services: xdg-base-directories: Deprecate XDG_LOG_HOME. Resent-From: "Philip McGrath" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 17 Jun 2023 18:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61982 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "Andrew Tropin" , "Bruno Victal" , 61982@debbugs.gnu.org, Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 61982-submit@debbugs.gnu.org id=B61982.168702617717612 (code B ref 61982); Sat, 17 Jun 2023 18:23:02 +0000 Received: (at 61982) by debbugs.gnu.org; 17 Jun 2023 18:22:57 +0000 Received: from localhost ([127.0.0.1]:52590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAaZc-0004Zz-TS for submit@debbugs.gnu.org; Sat, 17 Jun 2023 14:22:57 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:48467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAaZZ-0004Zl-RW for 61982@debbugs.gnu.org; Sat, 17 Jun 2023 14:22:54 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C3A055C00D1; Sat, 17 Jun 2023 14:22:48 -0400 (EDT) Received: from imap52 ([10.202.2.102]) by compute1.internal (MEProxy); Sat, 17 Jun 2023 14:22:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= philipmcgrath.com; h=cc:content-type:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1687026168; x= 1687112568; bh=BCN0yYxvud/vva5zhVkEiUEVXvRhPHLDDD97cPZd5js=; b=U mQV3ebJVKHaJqjgdxJcWzVdpmAc5PUz/CdyAgEcJCnO+HjRZNsuwuHaVee1W7XFE hOcNTLQEIqJXB+QJSj15Pc268wA4rSJ5f6zIgUGjOf3+3gqf8UUJAfqov118iJWh y2gSzj0iuTBxGvPq4syMoOS2ORKwu93QhV1k0ziDI1Bf87TxQSnLU12h3u8Tkprz 78rEOOvo9IyRbOcPrt9kA0RZK/0WX196yzGCp1Np1vM2XmQuySV1NWHUR89+qvaK /leLHdQOC9zzhrpktjS372NIfDPYvwHGhwHVxeF/7uahyj3HcuiQieAk+I5JQZtO u/Jb9CHTk42AwBXfXTI+g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1687026168; x=1687112568; bh=BCN0yYxvud/vv a5zhVkEiUEVXvRhPHLDDD97cPZd5js=; b=ksxpcXEpbt+TGUlgUqthpaPOERvlw VJnYdB2R7qIiXg51Ul59H6aorDa3eJXIqJBw0ySARm38IF2fgiwxcazNwZ54qrvY I2ZSuAAvAQLkozGV1BwGjal6Ul4YPhjOuZlp8aB04k7YPzGCx390Ty6KoanNJ0mQ /JNX4qyc5Ayts0Wrv7Wl38TbgGQ4j7tHAITRVKLbNF1l3qj7RVytGi+2yoUYZQFy Gzh7qFwfCnU2bSfO0TcTZzPhml9JFKAYF8Gd04QIYbEVn2ky/hA50FhzxzKM+rxD I3WwPQeKXo66dc+ZBgGSb531EZwRMnMS0lyMGcINtmBCJ93A9EovGPvzw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedvjedguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfrfhh ihhlihhpucfotgfirhgrthhhfdcuoehphhhilhhiphesphhhihhlihhpmhgtghhrrghthh drtghomheqnecuggftrfgrthhtvghrnhepiedvvdfghffgffehgfehvedvveeitdfggfeh leehvedvfeetvdfgveejgfdvgfehnecuffhomhgrihhnpehgnhhurdhorhhgpdhhohhmvg drlhhotggrlhdpghhnohhmvgdrohhrghdpghhtkhdrohhrghdprghrtghhlhhinhhugidr ohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hphhhilhhiphesphhhihhlihhpmhgtghhrrghthhdrtghomh X-ME-Proxy: Feedback-ID: i2b1146f3:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 32F86C60091; Sat, 17 Jun 2023 14:22:48 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-496-g8c46984af0-fm-20230615.001-g8c46984a Mime-Version: 1.0 Message-Id: <4f059a7c-8ab8-4957-be1d-afc882a80739@app.fastmail.com> In-Reply-To: <877cs4rspr.fsf@trop.in> References: <3005f8a58ec5afc447f2baf40958956bd0d16099.1678029530.git.mirai@makinata.eu> <0a0764da3fa04f9a02f37a7960a0c9608782854d.1678029530.git.mirai@makinata.eu> <87a5x1rrtv.fsf@trop.in> <877cs4rspr.fsf@trop.in> Date: Sat, 17 Jun 2023 14:22:27 -0400 From: "Philip McGrath" Content-Type: text/plain 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1687026195; a=rsa-sha256; cv=none; b=G9Frn/BeXDGXH+HfhU1nBlJrx4yndvtSU2jPG+4o48G+sZiZfskSQ/evSsIPlcfLK6pQEe ZZLe3a2Qh7K/p6Us7DBMG1+eqbQrv4nTqRGVRSchPrGsyGW0oVH8DlB9pHNOsVD3m0CW+A qN/CFaauzHg0OghQ6EQAOShi4Dd8AQ9wQaC4eL3uDpvPz39blhTQa9OFl3WhbwQYjFLB8m I9Vk9zYPH+717gsRlnpacSCb//eDX07pjKb1IVALfmbknbYfZPfS8bD0GyjuOYgHEdekB/ KAUnKZxgCkuDw6RgGDX1/LnQhzvgZC1nrURZVEbx0sOSLLeC0QvVR9077tbVNA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm2 header.b="U mQV3eb"; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=ksxpcXEp; dmarc=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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1687026195; 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:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=BCN0yYxvud/vva5zhVkEiUEVXvRhPHLDDD97cPZd5js=; b=XisFkM0rJE0gttz09tP/5gnruH1hpyJl/om9BaIDFyFiQPYrhgqzExVrskxJewd2NoD5Fk 7Brd/rYBIofqrdaYNwADEH/m++MjpSedqTK1WB3IPItLE/hWptWOuA+5JswI+ZO4KliaD3 vuq9FSm2jITwQARFWlA1QLH/mLtg/qODSFodZ2BWCO+0T7/vuNnQvG3rK6nzrWLzKJfxQh hux1IR5YHxunwYOhezR4xaaupaklEHq+RLXUlJs/2P0/aniUvdA2W7YOybssfsnQlIufSR T1OcyBelggQCpEOY/WfqhdlVIUfOVIoekz36sMSJbouAwv9uBadqZFtM00zrug== Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm2 header.b="U mQV3eb"; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=ksxpcXEp; dmarc=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-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -1.52 X-Spam-Score: -1.52 X-Migadu-Queue-Id: 51BF92DAA6 X-TUID: vnUu2/fDuw9q Hi, On Thu, Jun 15, 2023, at 11:28 PM, Andrew Tropin wrote: > On 2023-06-15 14:09, Philip McGrath wrote: > >> Hi, >> >> On Thu, Jun 15, 2023, at 5:35 AM, Andrew Tropin wrote: >>> >>> WDYT about adding (home-log-dir) function to (guix build utils)? >>> So we can prevent copypasting the same code all over home modules. >>> >>> Something like: >>> --8<---------------cut here---------------start------------->8--- >>> (define (home-log-dir) >>> "Returns a directory for user applications logs." >>> (string-append >>> (or (getenv "XDG_STATE_HOME") >>> (format #f "~a/.local/state" >>> (getenv "HOME"))) >>> "/log")) >>> --8<---------------cut here---------------end--------------->8--- >>> >> >> I still think idiomatic XDG structure is NOT to have a "/log" >> subdirectory like this, as I explained in >> . > > With a brief look I didn't find information about this idiom in > specification, but you can highlight it with quote or link. > > Anyway, I'm ok with storing logs in app subdirectory or "/log", not so > ok with storing them in the root of state home. > You are right that the idiomatic usage isn't made very explicit in the specification. In the specification itself, the idiom is implicit in the "Referencing this specification" section, which always uses a subdirectory: > > Other specifications may reference this specification by specifying the location of a data file as $XDG_DATA_DIRS/subdir/filename. This implies that: > > - Such file should be installed to $datadir/subdir/filename with $datadir defaulting to /usr/share. > > - A user-specific version of the data file may be created in $XDG_DATA_HOME/subdir/filename, taking into account the default value for $XDG_DATA_HOME if $XDG_DATA_HOME is not set. > > - Lookups of the data file should search for ./subdir/filename relative to all base directories specified by $XDG_DATA_HOME and $XDG_DATA_DIRS . If an environment variable is either not set or empty, its default value as defined by this specification should be used instead. > > Specifications may reference this specification by specifying the location of a configuration file as $XDG_CONFIG_DIRS/subdir/filename. This implies that: > > - Default configuration files should be installed to $sysconfdir/xdg/subdir/filename with $sysconfdir defaulting to /etc. > > - A user-specific version of the configuration file may be created in $XDG_CONFIG_HOME/subdir/filename, taking into account the default value for $XDG_CONFIG_HOME if $XDG_CONFIG_HOME is not set. > > - Lookups of the configuration file should search for ./subdir/filename relative to all base directories indicated by $XDG_CONFIG_HOME and $XDG_CONFIG_DIRS . If an environment variable is either not set or empty, its default value as defined by this specification should be used instead. > (Obviously $HOME/.local/bin is a special case, since using subdirectories there would defeat the point.) More than the text of the specification, I'd look at actual observed usage and documented best practices. The relevant Gnome Goal [1] (despite outbound linkrot) is consistent with every other developer guide I've seen in showing the use of subdirectories, e.g. in the Glib example code: ``` const char *cache_dir = g_get_user_cache_dir (); char *mydir = g_build_filename (cache_dir, "myapp", NULL); /* use it */ g_free (mydir); ``` (Glib now provides g_get_user_state_dir, too. [2]) The Arch wiki has a survey of XDG support status [3] that consistently shows applications using appropriate subdirectories. [1]: https://wiki.gnome.org/Initiatives/GnomeGoals/XDGConfigFolders [2]: https://docs.gtk.org/glib/func.get_user_state_dir.html [3]: https://wiki.archlinux.org/title/XDG_Base_Directory >> >> Aside from that, though, I thought the conclusion from >> was that it is the >> responsibility of Guix System or the installation mechanism for Guix >> on a foreign distribution (e.g. "/etc/profile.d/zzz-guix.sh") to >> initialize all of the XDG variables, so code like this can use >> `(getenv "XDG_STATE_HOME")` unconditionally (or indeed with a checked >> assertion). Maybe there's some context I'm forgetting, though. I've >> been looking into these things again as I attempt to solve >> : >> I noticed in the attached environment variables that entries under >> /home/philip/.guix-home/profile/ are duplicated in many search paths. > > home-state-dir function can also be useful, which can later become just > (getenv ("XDG_STATE_HOME")). > I'm not at all opposed to providing functions rather that using getenv everywhere: they could guard against typos, check invariants, and all the other usual helpful things. But---though maybe I'm missing some context---how often is it actually needed to pass these default values? As long as the upstream software supports XDG directories properly, I would think it should just do the right thing without having to pass a bunch of explicit configuration options. -Philip