From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Bo Johansson" Newsgroups: gmane.emacs.bugs Subject: bug#10980: 23.4; Variable init_environment incorrectly set Date: Fri, 9 Mar 2012 12:01:53 +0100 Message-ID: <91BFD8A43A0C4F29ADF1BB30E3861DAD@spc2> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0025_01CCFDEC.6B17E8E0" X-Trace: dough.gmane.org 1331313428 15378 80.91.229.3 (9 Mar 2012 17:17:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 9 Mar 2012 17:17:08 +0000 (UTC) To: 10980@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 09 18:17:06 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S63R6-0001uq-D8 for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Mar 2012 18:17:00 +0100 Original-Received: from localhost ([::1]:34251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S63R5-00022k-M8 for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Mar 2012 12:16:59 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46279) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S63PP-0001lX-Qz for bug-gnu-emacs@gnu.org; Fri, 09 Mar 2012 12:15:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S63PH-0002Gs-Mp for bug-gnu-emacs@gnu.org; Fri, 09 Mar 2012 12:15:15 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S63PH-0002Gl-Iy for bug-gnu-emacs@gnu.org; Fri, 09 Mar 2012 12:15:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1S63QB-0000Q6-JX for bug-gnu-emacs@gnu.org; Fri, 09 Mar 2012 12:16:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Bo Johansson" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Mar 2012 17:16:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10980 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: Original-Received: via spool by submit@debbugs.gnu.org id=B.13313133321550 (code B ref -1); Fri, 09 Mar 2012 17:16:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Mar 2012 17:15:32 +0000 Original-Received: from localhost ([127.0.0.1]:40783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S63Pe-0000Ox-SO for submit@debbugs.gnu.org; Fri, 09 Mar 2012 12:15:32 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37458) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S5xcU-0007nw-NK for submit@debbugs.gnu.org; Fri, 09 Mar 2012 06:04:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5xbB-0005fr-5K for submit@debbugs.gnu.org; Fri, 09 Mar 2012 06:03:27 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:54295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5xbB-0005fY-1R for submit@debbugs.gnu.org; Fri, 09 Mar 2012 06:03:01 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5xb3-0003i4-Q3 for bug-gnu-emacs@gnu.org; Fri, 09 Mar 2012 06:03:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5xab-0005ZD-N5 for bug-gnu-emacs@gnu.org; Fri, 09 Mar 2012 06:02:52 -0500 Original-Received: from seluib4vp34.perspektivbredband.net ([81.186.254.26]:35180) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5xab-0005W1-AP for bug-gnu-emacs@gnu.org; Fri, 09 Mar 2012 06:02:25 -0500 Original-Received: from spc2 (hd5b913e4.seluldx.dyn.perspektivbredband.net [213.185.19.228]) by seluib4vp34.perspektivbredband.net (Postfix) with SMTP id 2F7FF60556 for ; Fri, 9 Mar 2012 12:01:58 +0100 (CET) X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 15.4.3538.513 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3538.513 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Fri, 09 Mar 2012 12:15:29 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-Mailman-Approved-At: Fri, 09 Mar 2012 12:16:57 -0500 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:57588 Archived-At: Det här är ett flerdelat meddelande i MIME-format. ------=_NextPart_000_0025_01CCFDEC.6B17E8E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hej! --------------------------- Background I am used to "live" in Emacs and want to get the same result doing = something from within Emacs as doing it from a Windows command prompt. For example (compile "dmake" nil) in Emacs and executing dmake in a = Windows command window should give the same result. --------------------------- Example of Problems Emacs replaces the environment variable SHELL at start up in Windows to = something like "C:/Program Files (x86)/GNU Emacs 23.4/bin/cmdproxy.exe". = Processes started by Emacs will inherit this value. Many utilities uses SHELL. One example is: With " ... cmdproxy.exe" as = value of SHELL dmake is configured to use a Kornshell compatible shell. --------------------------- Solution ideas A long time goal should be to avoid changing the environment variable = within Emacs. Emacs should (internally) at least not change the value of = SHELL. A short time solution is to make the initial environment variable = available as stated in = http://www.gnu.org/software/emacs/manual/html_node/emacs/Environment.html= : "The variable initial-environment stores the initial environment = inherited by Emacs". This make it possible in emacs-git/lisp/progmodes/compile.el:1479 (defun compilation-start (command &optional mode name-function = highlight-regexp) to use the variable compilation-environment to temporary override the in = emacs internal used environment variables. In emacs-git/lisp/progmodes/simple.el:2088 (defun shell-command (command &optional output-buffer error-buffer) the corresponding possibility is however not available. --------------------------- Description of the Bug Below follows a list of steps done at start up. The problem is that step = 2) changes the environment variables before step 4) sets the variable = initial_environment. 1) The function init_environment is called emacs-git/src/emacs.c:1416 #ifdef MSDOS /* Call early 'cause init_environment needs it. */ init_dosfns (); /* Set defaults for several environment variables. */ if (initialized) init_environment (argc, argv, skip_args); else tzset (); #endif /* MSDOS */ #ifdef WINDOWSNT globals_of_w32 (); /* Initialize environment from registry settings. */ init_environment (argv); init_ntproc (); /* must precede init_editfns. */ #endif 2) The function init_environment changes the environment variables T:/emacs-git/src/w32.c:1528:init_environment (char ** argv) Do a lot of changes to the environment variables. 3) The function set_initial_environment is called to save the = "initial_environment" emacs-git/src/emacs.c:1440 /* 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 (initialized || ((strcmp (argv[argc-1], "dump") !=3D 0 && strcmp (argv[argc-1], "bootstrap") !=3D 0))) set_initial_environment (); 4) The variable initial_environment is set by set_initial_environment emacs-git/src/callproc.c:1616 set_initial_environment (void) emacs-git/src/callproc.c:1624 Vinitial_environment =3D Fcopy_sequence (Vprocess_environment); ----------------------------------------------------- In GNU Emacs 23.4.1 (i386-mingw-nt6.1.7601) of 2012-02-04 on MARVIN Windowing system distributor `Microsoft Corp.', version 6.1.7601 configured using `configure --with-gcc (4.4) --cflags = -ID:/devel/emacs/libs/libXpm-3.5.8/include = -ID:/devel/emacs/libs/libXpm-3.5.8/src = -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include = -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include = -ID:/devel/emacs/libs/giflib-4.1.4-1/include = -ID:/devel/emacs/libs/jpeg-6b-4/include = -ID:/devel/emacs/libs/tiff-3.8.2-1/include' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: SVE value of $XMODIFIERS: nil locale-coding-system: cp1252 default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: diff-auto-refine-mode: t shell-dirtrack-mode: t delete-selection-mode: t show-paren-mode: t cua-mode: t tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t auto-fill-mode: t Recent input: x r e p o r Recent messages: Loading cua-base...done Loading paren...done userDotEmacs Done Finding all versions of R on your system... Sorry, no version of R could be found on your system. Making completion list... Load-path shadows: None found. Features: (shadow sort mail-extr message ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc time-date mm-util mail-prsvr gmm-utils mailheader canlock sha1 hex-util hashcash mail-utils emacsbug help-mode view psvn byte-opt warnings bytecomp byte-compile derived edmacro kmacro wid-edit log-edit pcvs-util add-log diff-mode easy-mmode pp elp ediff-merg ediff-diff ediff-wind ediff-mult ediff-help ediff-init ediff-util dired tex-mik preview-latex tex-site auto-loads ess-eldoc ess-toolbar ess-mouse mouseme thingatpt browse-url ess-menu ess-swv ess-noweb noweb-font-lock-mode ess-bugs-l essd-els ess-sas-d ess-sas-l ess-sas-a executable shell ess-arc-d ess-vst-d ess-xls-d ess-lsp-l ess-sta-d ess-sta-l cc-vars cc-defs make-regexp ess-sp6w-d ess-sp4-d ess-sp3-d ess-r-d ess-r-args assoc ess-s-l ess-inf ess-utils comint ring ess-mode noweb-mode ess ess-custom regexp-opt ess-compat ess-site htmlize-view easymenu w32-winprint htmlize cl cl-19 delsel server advice help-fns advice-preload paren cua-base cus-start cus-load tooltip ediff-hook vc-hooks lisp-float-type mwheel dos-w32 disp-table ls-lisp w32-win w32-vars tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process multi-tty emacs) ------=_NextPart_000_0025_01CCFDEC.6B17E8E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hej!
 
--------------------------- Background
I am used to "live" in Emacs and want to get the same result doing=20 something from within Emacs as doing it from a Windows command = prompt.
For example (compile "dmake" nil) in Emacs and executing dmake in a = Windows=20 command window should give the same result.
 
--------------------------- Example of Problems
Emacs replaces the environment variable SHELL at start up in = Windows to=20 something like "C:/Program Files (x86)/GNU Emacs 23.4/bin/cmdproxy.exe". = Processes started by Emacs will inherit this value.
 
Many utilities uses SHELL. One example is:  With " ... = cmdproxy.exe"=20 as value of SHELL dmake is configured to use a Kornshell compatible = shell.
 
--------------------------- Solution ideas
A long time goal should be to avoid changing the environment = variable=20 within Emacs. Emacs should (internally) at least not change the value of = SHELL.
 
A short time solution is to make the initial environment variable = available=20 as stated in http://www.gnu.org/software/emacs/manual/html_node/emacs/Envir= onment.html:=20 "The variable initial-environment stores the initial environment = inherited by=20 Emacs".
 
This make it possible in
emacs-git/lisp/progmodes/compile.el:1479
(defun compilation-start (command &optional mode name-function=20 highlight-regexp)
to use the variable compilation-environment to temporary override = the in=20 emacs internal used environment variables.
 
In emacs-git/lisp/progmodes/simple.el:2088
(defun shell-command (command &optional output-buffer=20 error-buffer)
the corresponding possibility is however not available.
 
--------------------------- Description of the Bug
Below follows a list of steps done at start up. The problem is that = step 2)=20 changes the environment variables before step 4) sets the variable=20 initial_environment.
 
1) The function init_environment is called
 
emacs-git/src/emacs.c:1416
#ifdef MSDOS
  /* Call early 'cause init_environment needs it.  = */
  init_dosfns ();
  /* Set defaults for several environment variables.  = */
  if (initialized)
    init_environment (argc, argv, skip_args);
  else
    tzset ();
#endif /* MSDOS */
 
#ifdef WINDOWSNT
  globals_of_w32 ();
  /* Initialize environment from registry settings.  = */
  init_environment (argv);
  init_ntproc ();    /* must precede=20 init_editfns.  */
#endif
 
2) The function init_environment changes the environment = variables
 
T:/emacs-git/src/w32.c:1528:init_environment (char ** argv)
Do a lot of changes to the environment variables.
 
3) The function set_initial_environment is called to save the=20 "initial_environment"
 
emacs-git/src/emacs.c:1440
  /* Initialize and GC-protect Vinitial_environment and
     Vprocess_environment before=20 set_initial_environment fills them
     in.  */
  if (!initialized)
    syms_of_callproc ();
  /* egetenv is a pretty low-level facility, which may get = called=20 in
     many circumstances; it seems flimsy to put = off=20 initializing it
     until calling init_callproc.  Do not = do it=20 when dumping.  */
  if (initialized || ((strcmp (argv[argc-1], "dump") !=3D = 0
           &n= bsp;  =20 && strcmp (argv[argc-1], "bootstrap") !=3D 0)))
    set_initial_environment ();
 
4) The variable initial_environment is set by = set_initial_environment
 
emacs-git/src/callproc.c:1616
set_initial_environment (void)
emacs-git/src/callproc.c:1624
Vinitial_environment =3D Fcopy_sequence = (Vprocess_environment);
 
 
-----------------------------------------------------
In GNU Emacs 23.4.1 (i386-mingw-nt6.1.7601)
of 2012-02-04 on MARVIN
Windowing system distributor `Microsoft Corp.', version = 6.1.7601
configured using `configure --with-gcc (4.4) --cflags=20 -ID:/devel/emacs/libs/libXpm-3.5.8/include=20 -ID:/devel/emacs/libs/libXpm-3.5.8/src=20 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include=20 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include=20 -ID:/devel/emacs/libs/giflib-4.1.4-1/include=20 -ID:/devel/emacs/libs/jpeg-6b-4/include=20 -ID:/devel/emacs/libs/tiff-3.8.2-1/include'
 
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: SVE
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t
 
Major mode: Lisp Interaction
 
Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  delete-selection-mode: t
  show-paren-mode: t
  cua-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-fill-mode: t
 
Recent input:
<escape> x r e p o <tab> r <tab> = <return>
 
Recent messages:
Loading cua-base...done
Loading paren...done
userDotEmacs Done
Finding all versions of R on your system...
Sorry, no version of R could be found on your system.
Making completion list...
 
Load-path shadows:
None found.
 
Features:
(shadow sort mail-extr message ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse=20 rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util = netrc
time-date mm-util mail-prsvr gmm-utils mailheader canlock sha1=20 hex-util
hashcash mail-utils emacsbug help-mode view psvn byte-opt = warnings
bytecomp byte-compile derived edmacro kmacro wid-edit log-edit=20 pcvs-util
add-log diff-mode easy-mmode pp elp ediff-merg ediff-diff = ediff-wind
ediff-mult ediff-help ediff-init ediff-util dired tex-mik=20 preview-latex
tex-site auto-loads ess-eldoc ess-toolbar ess-mouse mouseme = thingatpt
browse-url ess-menu ess-swv ess-noweb noweb-font-lock-mode = ess-bugs-l
essd-els ess-sas-d ess-sas-l ess-sas-a executable shell = ess-arc-d
ess-vst-d ess-xls-d ess-lsp-l ess-sta-d ess-sta-l cc-vars = cc-defs
make-regexp ess-sp6w-d ess-sp4-d ess-sp3-d ess-r-d ess-r-args = assoc
ess-s-l ess-inf ess-utils comint ring ess-mode noweb-mode ess=20 ess-custom
regexp-opt ess-compat ess-site htmlize-view easymenu = w32-winprint
htmlize cl cl-19 delsel server advice help-fns advice-preload = paren
cua-base cus-start cus-load tooltip ediff-hook vc-hooks=20 lisp-float-type
mwheel dos-w32 disp-table ls-lisp w32-win w32-vars tool-bar dnd=20 fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer=20 select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu = font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan = thai
tai-viet lao korean japanese hebrew greek romanian slovak czech=20 european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook=20 help
simple abbrev loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule = custom
widget hashtable-print-readable backquote make-network-process=20 multi-tty
emacs)
------=_NextPart_000_0025_01CCFDEC.6B17E8E0--