bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23118: Duplicate entries in various environment variables


From: Leo Prikler
Subject: bug#23118: Duplicate entries in various environment variables
Date: Thu, 03 Dec 2020 11:58:39 +0100
User-agent: Evolution 3.34.2

Hello, Chris

Am Freitag, den 25.03.2016, 20:59 -0700 schrieb Chris Marusich:
> Hi,
> 
> I've noticed that my environment variables contain duplicate
> (sometimes
> more) entries.  This occurs regardless of whether the user logs in
> directly via a tty or via a desktop environment like GNOME.
> 
> [...]
> 
> As you can see, there are some environment variables with up to 9
> duplicate entries.  Is this expected?  Is it a problem?  Why is it
> happening?  Assuming that it is not expected and that it is a
> problem,
> how can we prevent it from happening?
It has been pointed out, that this is somewhat expected when wrapping
the same environment variable multiple times.  For instance, you as a
GNOME user might already have gtk+ in your GTK path if you run GNOME,
but GNOME applications can not rely on that and thus need to add their
own.  As the number of software components, that use it increases, so
does the number of mentions.  
In the special case of gnome-terminal, this is user-visible by printing
out env, but other applications get launched in a similar manner all
the time without you noticing.  Perhaps one could patch GNOME terminal
to clear those variables before spawning the shell, but that's going to
be a bit fiddly.  Alternatively, one could enforce GTK_PATH by using
"=" instead of prefix.

More generally, this can become an issue when environment variables
reach a certain size (and has led to bug reports in Guix before, which
have since been fixed).  POSIX mandates a syntax, that would allow
removing already present components first (see [1]), but I can hardly
imagine what monstrosities we would need to cook up to do this
reliably.  Not to mention, that some otherwise POSIX-compliant shells
might not implement that syntax (correctly).

Regards,
Leo

[1] 
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02






reply via email to

[Prev in Thread] Current Thread [Next in Thread]