From: Mark H Weaver <mhw@netris.org>
To: Pierre Neidhardt <mail@ambrevar.xyz>
Cc: guix-devel@gnu.org
Subject: Re: Profiles/manifests-related command line interface enhancements
Date: Thu, 24 Oct 2019 17:35:27 -0400 [thread overview]
Message-ID: <87v9sdvnb9.fsf@netris.org> (raw)
In-Reply-To: <87o8y5ucyj.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Thu, 24 Oct 2019 22:04:52 +0200")
Hi Pierre,
Pierre Neidhardt <mail@ambrevar.xyz> writes:
> Mark H Weaver <mhw@netris.org> writes:
>
>> It wouldn't be sufficient to remove them. You'd have to restore the
>> previous settings. For example, if we remove the settings for PATH,
>> MANPATH, etc, without restoring the previous settings, I doubt that you
>> would be pleased with the results.
>
> I don't understand.
> Which previous settings?
I'm talking about the previous values of the environment variables, as
they existed before activating the new profile.
> As far as I understand, activating a profile never _removes_ any value
> from environment variables.
It doesn't remove them, but it overwrites them, thus losing the
information of what the previous environment was. Now, it's true that
for *most* of those environment variables, the previous value is a
suffix of the new value, but that's not always the case. One notable
counter-example is GUIX_PROFILE itself, which is simply overwritten.
Others include GIT_EXEC_PATH and ASPELL_DICT_DIR.
>> It seems to me that the most natural approach to allow restoring the
>> previous environment settings is to launch a subshell when you activate
>> a profile. That subshell can then simply be exited to restore the
>> previous settings.
>
> I gave the example of EXWM, for which the user would like to change the
> profile but a subshell won't do since it won't reflect on the parent
> process, Emacs.
There's no way to change the environment variable in Emacs without
running Emacs lisp code, e.g. by running M-x setenv.
In general, every process has a complete copy of its own environment
variables, which live in its own address space. When a process launches
a child process, it gets to decide what the child's initial environment
will be. Usually, but not always, programs pass a copy of their own
environment to child processes, and there are convenience functions that
make this common case easier. From the kernel's point of view,
environment variables are passed to child processes exactly the same way
that command-line arguments are, although by convention they are treated
differently by user interfaces.
There's no mechanism for child processes to ask their parent processes
to modify their environment. Each program needs to provide its own
mechanism for modifying its internal environment, and most don't even
provide such a mechanism. For example, Ratpoison provides a command to
modify its own environment (C-t setenv, iirc), but I have no idea how to
modify gnome-session's environment.
Note that I'm not passing judgement on the merits of your proposals, I'm
merely letting you know that they cannot be implemented as envisioned,
at least not if I understand correctly.
Regards,
Mark
next prev parent reply other threads:[~2019-10-24 21:36 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-23 16:37 Profiles/manifests-related command line interface enhancements Pierre Neidhardt
2019-10-24 9:00 ` Mark H Weaver
2019-10-24 9:32 ` Pierre Neidhardt
2019-10-24 16:28 ` Pierre Neidhardt
2019-10-24 16:42 ` Danny Milosavljevic
2019-10-24 18:16 ` Pierre Neidhardt
2019-10-24 19:23 ` Mark H Weaver
2019-10-24 20:04 ` Pierre Neidhardt
2019-10-24 21:35 ` Mark H Weaver [this message]
2019-10-25 9:29 ` Pierre Neidhardt
2019-10-31 11:38 ` Pierre Neidhardt
2019-11-03 14:18 ` Ludovic Courtès
2019-11-04 10:39 ` Pierre Neidhardt
2019-11-04 11:06 ` zimoun
2019-11-05 6:26 ` Konrad Hinsen
2019-11-05 8:35 ` Hartmut Goebel
2019-11-05 9:03 ` Konrad Hinsen
2019-11-05 9:09 ` Hartmut Goebel
2019-11-05 9:22 ` Pierre Neidhardt
2019-11-05 15:36 ` zimoun
2019-11-05 16:05 ` Konrad Hinsen
2019-11-06 12:09 ` zimoun
2019-11-07 13:07 ` Konrad Hinsen
2019-11-06 17:07 ` Ludovic Courtès
2019-11-06 22:21 ` Bengt Richter
2019-11-07 13:52 ` Konrad Hinsen
2019-11-06 16:35 ` Ludovic Courtès
2019-11-07 7:46 ` Konrad Hinsen
2019-11-07 9:04 ` Pierre Neidhardt
2019-11-07 11:14 ` Konrad Hinsen
2019-11-07 11:36 ` Pierre Neidhardt
2019-11-09 17:59 ` Ludovic Courtès
2019-11-10 9:36 ` Konrad Hinsen
2019-11-11 15:56 ` A better XML, config is code (was Re: Profiles/manifests-related command line...) Giovanni Biscuolo
2019-11-13 15:28 ` Konrad Hinsen
2019-11-12 8:55 ` Profiles/manifests-related command line interface enhancements Andy Wingo
2019-11-12 20:07 ` Konrad Hinsen
2019-11-13 20:58 ` Bengt Richter
2019-11-16 22:02 ` Ludovic Courtès
2019-11-17 10:44 ` Konrad Hinsen
2019-11-18 14:25 ` zimoun
2019-11-19 10:24 ` Konrad Hinsen
2019-11-23 17:10 ` Ludovic Courtès
2019-11-25 11:06 ` Konrad Hinsen
2019-11-26 9:51 ` On DSLs Ludovic Courtès
2019-12-02 19:05 ` zimoun
2019-12-02 19:11 ` Julien Lepiller
2019-12-03 10:19 ` Konrad Hinsen
2019-12-03 14:12 ` Ricardo Wurmus
2019-12-03 15:46 ` zimoun
2019-12-04 6:33 ` Bengt Richter
2019-12-10 16:26 ` Ludovic Courtès
2019-12-08 8:48 ` Konrad Hinsen
2019-12-03 10:26 ` Konrad Hinsen
2019-12-03 12:00 ` zimoun
2019-11-11 14:13 ` Profiles/manifests-related command line interface enhancements Hartmut Goebel
2019-11-16 22:27 ` Ludovic Courtès
2019-11-17 11:30 ` Konrad Hinsen
2019-11-18 14:40 ` zimoun
2019-12-22 19:40 ` Andreas Enge
2019-12-22 20:39 ` Pjotr Prins
2019-11-18 14:15 ` zimoun
2019-11-26 9:36 ` Ludovic Courtès
2019-11-06 16:42 ` Ludovic Courtès
2019-11-07 12:57 ` zimoun
2019-11-17 10:35 ` Package inputs in manifests Ludovic Courtès
2019-11-17 23:11 ` Bengt Richter
2019-11-18 17:14 ` zimoun
2019-11-23 14:05 ` Ludovic Courtès
2019-11-24 5:49 ` Bengt Richter
2019-11-24 7:17 ` Timothy Sample
2019-11-25 3:42 ` Bengt Richter
2019-11-18 16:18 ` zimoun
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=87v9sdvnb9.fsf@netris.org \
--to=mhw@netris.org \
--cc=guix-devel@gnu.org \
--cc=mail@ambrevar.xyz \
/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.