aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorNoam Postavsky2016-06-29 18:52:57 -0400
committerNoam Postavsky2016-07-18 17:22:06 -0400
commit73f0715df53c6a12a3d9039ac1a1664d30c293ff (patch)
tree713607d32db74cf9c0f3c35dcc3a65e40da1304e /test/src
parent1879b9055eaf5c9f3fd126c2c21450cdd8c83262 (diff)
downloademacs-73f0715df53c6a12a3d9039ac1a1664d30c293ff.tar.gz
emacs-73f0715df53c6a12a3d9039ac1a1664d30c293ff.zip
Keep w32 environment settings internal only
* src/emacs.c (main) [WINDOWSNT]: Move init_environment calls after the set_initial_environment call. This prevents Emacs' modifications to the environment from contaminating Vprocess_environment and Vinitial_environment (Bug #10980). * src/callproc.c (getenv_internal) [WINDOWSNT]: Consult Emacs' internal environment in as a fallback to Vprocess_environment. * test/src/callproc-tests.el (initial-environment-preserved): New Test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/callproc-tests.el39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/src/callproc-tests.el b/test/src/callproc-tests.el
new file mode 100644
index 00000000000..46541aba78c
--- /dev/null
+++ b/test/src/callproc-tests.el
@@ -0,0 +1,39 @@
1;;; callproc-tests.el --- callproc.c tests -*- lexical-binding: t -*-
2
3;; Copyright (C) 2016 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19
20;;; Code:
21
22(require 'ert)
23(eval-when-compile (require 'cl-lib))
24
25(ert-deftest initial-environment-preserved ()
26 "Check that `initial-environment' is not modified by Emacs (Bug #10980)."
27 (skip-unless (eq system-type 'windows-nt))
28 (cl-destructuring-bind (initial-shell shell)
29 (with-temp-buffer
30 (let ((process-environment (cons "SHELL" process-environment)))
31 (call-process (expand-file-name invocation-name invocation-directory)
32 nil t nil
33 "--batch" "-Q" "--eval"
34 (prin1-to-string
35 '(progn (prin1 (getenv-internal "SHELL" initial-environment))
36 (prin1 (getenv-internal "SHELL"))))))
37 (split-string-and-unquote (buffer-string)))
38 (should (equal initial-shell "nil"))
39 (should-not (equal initial-shell shell))))