all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Liliana Marie Prikler <liliana.prikler@gmail.com>
Cc: "Ludovic Courtès" <ludo@gnu.org>, 53447@debbugs.gnu.org
Subject: [bug#53447] [PATCH] doc: Unset environment variables considered harmful
Date: Mon, 24 Jan 2022 17:27:00 -0500	[thread overview]
Message-ID: <87y2344vnv.fsf_-_@gmail.com> (raw)
In-Reply-To: <19bb45159c0934e8d84035abdcfb00d8202233dd.camel@gmail.com> (Liliana Marie Prikler's message of "Sat, 22 Jan 2022 18:53:02 +0100")

Hi Liliana and Ludo,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Hi Ludo,
>
> Am Samstag, dem 22.01.2022 um 17:04 +0100 schrieb Ludovic Courtès:
>> Hi Liliana,
>> 
>> Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:
>> 
>> > * doc/guix.texi (Application Setup): Add subsection for implicit
>> > environment variables.
>> > ---
>> >  doc/guix.texi | 27 +++++++++++++++++++++++++++
>> >  1 file changed, 27 insertions(+)
>> > 
>> > diff --git a/doc/guix.texi b/doc/guix.texi
>> > index 912a8e3c5a..805e3b611f 100644
>> > --- a/doc/guix.texi
>> > +++ b/doc/guix.texi
>> > @@ -2023,6 +2023,33 @@ want to avoid auto-loading the Emacs
>> > packages installed with Guix, you
>> >  can do so by running Emacs with the @option{--no-site-file} option
>> >  (@pxref{Init File,,, emacs, The GNU Emacs Manual}).
>> >  
>> > +@subsection Implicit Environment Variables
>> > +
>> > +Many environment variables are defined in a way that assumes a
>> > certain
>> > +default value, even if unset.  For example, bash uses the current
>> > +working directory as @env{PATH} if unset, or @env{XDG_CONFIG_HOME}
>> > +expands to @file{$HOME/.config}.  Some of these defaults remain
>> > the same
>> > +whether a package is used through Guix or not---however,
>> > environment
>> > +variables referring to @file{/etc} or @file{/usr} typically have
>> > their
>> > +meaning subtly changed in Guix.  An application installed via Guix
>> > might
>> > +instead look up files in its own @file{etc} structure, or (if a
>> > +search-path was specified) even override the default for packages
>> > from
>> > +the foreign distro.
>> 
>> I think I miss some context: what concrete problem is this trying to
>> solve?  What is it telling me to do?
>> 
>> I wonder to what extent this is actionable for a user, due to wording
>> that leaves it up to the reader to figure out how this applies to
>> them:
>> 
>>   “Many environment variables”
>>   “a certain default value”
>>   “Some of these”
>>   “An application installed via Guix might”
>>   “problems coming from such implicitly defined”
>>   …
>> 
>> I think the “Application Setup” section should be as concrete as
>> possible, with clear instructions (“If X then type Y”), possibly
>> followed by explanations that curious readers can read and that
>> others can skip.
>> 
>> WDYT?

I initially thought it unnecessary and vague, but after reading the bug
reports listed below, it seems to make sense to document it.  And
reading it now, that's probably the issue I encountered myself in
https://issues.guix.gnu.org/53233.

> I think there are too many examples to exhaustively list them all, but
> to give an example, [1, 2, 3, 4] are all the same bug and in [2] Carlo
> said we should document this under "Application Setup".  My personal
> stance is that the Guix behaviour is not a bug and other distros are
> weird for not explicitly binding it.

I like to see this as a bug, so I've opened one as 53514; Guix should
strive to not mess with the host environment, and setting global
variables used by both Guix and a potentially foreign host goes against
this.  The proper fix would be to patch all applications in Guix to use
Guix-specific variables, such as GUIX_XDG_DATA_DIRS instead of
XDG_DATA_DIRS.

> I know my wording is not the best here, but "If X then Y" is a little
> too late when your session broke.  But if your session broke and you
> read the manual saying "blah blah unset environment variables evil",
> you are more likely to suspect "hmm, maybe evil environment variables
> were evil".  Fortunately, with distros trying out Flatpaks and Snaps,
> XDG_DATA_DIRS is less likely to break them, but still.  We never know
> which variable will be the next to blow things up.

Agreed that this is useful in the meantime.  Perhaps add a TODO comment
pointing to the bug I've opened.

Thank you,

Maxim




  reply	other threads:[~2022-01-24 22:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-22 14:13 [bug#53447] [PATCH] doc: Unset environment variables considered harmful Liliana Marie Prikler
2022-01-22 16:04 ` Ludovic Courtès
2022-01-22 17:53   ` Liliana Marie Prikler
2022-01-24 22:27     ` Maxim Cournoyer [this message]
2022-01-25 13:29       ` [bug#53447] Introducing ‘GUIX_’-prefixed environment variables Ludovic Courtès
2022-01-26  1:56         ` Maxim Cournoyer
2022-01-26 12:05           ` Ludovic Courtès
2022-01-26 20:03             ` Liliana Marie Prikler
2022-01-27  4:53               ` Maxim Cournoyer
2022-01-25  7:39     ` [bug#53447] [PATCH] doc: Unset environment variables considered harmful Ludovic Courtès
2022-01-25 19:21       ` Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2344vnv.fsf_-_@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=53447@debbugs.gnu.org \
    --cc=liliana.prikler@gmail.com \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.