From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: bo.johansson@lsn.se, 10980@debbugs.gnu.org
Subject: bug#10980: GNU bugs information: logs for bug#10980
Date: Mon, 20 Jun 2016 20:23:26 -0400 [thread overview]
Message-ID: <CAM-tV-8fHB959a5kwuTtEi+owmEim2cjMRPSTHdyVTh38rWMrg@mail.gmail.com> (raw)
In-Reply-To: <83twh3r5vr.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1606 bytes --]
On Wed, Jun 8, 2016 at 12:40 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> I don't think we want to have environment-related functions that are
> specific to Windows, that goes against the goal of portability of
> Emacs packages.
>
> I'm okay with considering patches specific to w32 that would eliminate
> the need for pushing variables into the environment of subprocesses,
> and/or leave initial-environment unaffected by the pushed values
How about splitting apart initialization of Vinitial_environment and
Vprocess_environment and moving the former earlier so that it's
unaffected by Emacs' manipulations of the environment? See attached
patch.
> I guess you refer to the fact that msysgit uses $USERPROFILE as the
> alternative home directory if $HOME is not set? If so, I'd rather
> suggest to report a bug to msysgit maintainers: they are behaving
> against platform recommendations.
[...]
> If you look in the $USERPROFILE directory on a typical Windows
> machine, you won't see there any sub-directory or file created by an
> application, only a few standard sub-directories. Applications do
> generally follow the above recommendations; for example, I have
> Firefox installed, which keeps my customizations in
> $APPDATA/Mozilla/Firefox/Profiles/. So Git is the odd one out if it
> puts its ~/.gitconfig file in $USERPROFILE.
To me it makes sense to have $HOME map to $USERPROFILE, and $APPDATA
is like $XDG_CONFIG_HOME (usually ~/.config/ on GNU/Linux). However,
this is purely subjective as there are no platform recommendations
about translating environment variables to other platforms.
[-- Attachment #2: 0001-Set-Vinitial_environment-before-changing-env-vars.patch --]
[-- Type: application/octet-stream, Size: 3432 bytes --]
From d67fb15fdcd7a742ce0bb7963ddcfea430f7ef19 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Mon, 20 Jun 2016 20:08:15 -0400
Subject: [PATCH] Set Vinitial_environment before changing env vars
* src/callproc.c (make_list_from_environ): Renamed from
set_initial_environment, just return a Lisp list of the environment
instead of setting of Vprocess_environment and Vinitial_environment
directly.
* src/emacs.c (main): Set Vinitial_environment before init_environment
is called so that it gets the initial environment inherited from the
parent process and remains unaffected by modifications Emacs
performs (Bug #10980).
---
src/callproc.c | 12 +++++-------
src/emacs.c | 14 ++++++++------
src/lisp.h | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/callproc.c b/src/callproc.c
index 0729782..924b755 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1577,16 +1577,14 @@ init_callproc (void)
#endif
}
-void
-set_initial_environment (void)
+Lisp_Object
+make_list_from_environ (void)
{
char **envp;
+ Lisp_Object list = Qnil;
for (envp = environ; *envp; envp++)
- Vprocess_environment = Fcons (build_string (*envp),
- Vprocess_environment);
- /* Ideally, the `copy' shouldn't be necessary, but it seems it's frequent
- to use `delete' and friends on process-environment. */
- Vinitial_environment = Fcopy_sequence (Vprocess_environment);
+ list = Fcons (build_string (*envp), list);
+ return list;
}
void
diff --git a/src/emacs.c b/src/emacs.c
index bb85733..1dbb3f6 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1210,10 +1210,17 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
#ifdef HAVE_WINDOW_SYSTEM
init_fringe_once (); /* Swap bitmaps if necessary. */
#endif /* HAVE_WINDOW_SYSTEM */
+
+ /* Initialize and GC-protect Vinitial_environment and Vprocess_environment
+ before filling them in. */
+ syms_of_callproc ();
}
init_alloc ();
+ if (! dumping)
+ Vinitial_environment = make_list_from_environ ();
+
if (do_initial_setlocale)
{
fixup_locale ();
@@ -1366,16 +1373,11 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
ns_init_locale ();
#endif
- /* Initialize and GC-protect Vinitial_environment and
- Vprocess_environment before set_initial_environment fills them
- in. */
- if (!initialized)
- syms_of_callproc ();
/* egetenv is a pretty low-level facility, which may get called in
many circumstances; it seems flimsy to put off initializing it
until calling init_callproc. Do not do it when dumping. */
if (! dumping)
- set_initial_environment ();
+ Vprocess_environment = make_list_from_environ ();
/* AIX crashes are reported in system versions 3.2.3 and 3.2.4
if this is not done. Do it after set_global_environment so that we
diff --git a/src/lisp.h b/src/lisp.h
index e0eb52a..33e1f70 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4199,7 +4199,7 @@ extern void setup_process_coding_systems (Lisp_Object);
extern int child_setup (int, int, int, char **, bool, Lisp_Object);
extern void init_callproc_1 (void);
extern void init_callproc (void);
-extern void set_initial_environment (void);
+extern Lisp_Object make_list_from_environ (void);
extern void syms_of_callproc (void);
/* Defined in doc.c. */
--
2.6.2.windows.1
next prev parent reply other threads:[~2016-06-21 0:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAM-tV-8GBPbR3WO9Y_k6mrWop2ZcJCL16R9R2=zmFU5brRp5+w@mail.gmail.com>
[not found] ` <handler.s.R.14653322689344.info.0@debbugs.gnu.org>
2016-06-08 3:54 ` bug#10980: GNU bugs information: logs for bug#10980 Noam Postavsky
2016-06-08 16:40 ` Eli Zaretskii
2016-06-21 0:23 ` Noam Postavsky [this message]
2016-06-21 13:27 ` Eli Zaretskii
2016-06-21 21:03 ` Noam Postavsky
2016-06-22 2:39 ` Eli Zaretskii
2016-06-22 2:54 ` Noam Postavsky
2016-06-22 14:57 ` Eli Zaretskii
2016-06-29 13:12 ` Noam Postavsky
2016-06-29 15:15 ` Eli Zaretskii
2016-06-29 15:26 ` Noam Postavsky
2016-06-29 15:34 ` Eli Zaretskii
2016-06-29 23:02 ` Noam Postavsky
2016-07-09 10:57 ` Eli Zaretskii
2016-07-18 21:52 ` Noam Postavsky
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=CAM-tV-8fHB959a5kwuTtEi+owmEim2cjMRPSTHdyVTh38rWMrg@mail.gmail.com \
--to=npostavs@users.sourceforge.net \
--cc=10980@debbugs.gnu.org \
--cc=bo.johansson@lsn.se \
--cc=eliz@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/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.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.