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 initial-environment incorrectly set Date: Wed, 28 Mar 2012 10:56:44 +0200 Message-ID: <90DA7D85167A495EBDEE340787E9CD5F@spc2> References: <91BFD8A43A0C4F29ADF1BB30E3861DAD@spc2> <83d383uwri.fsf@gnu.org> <638D93647FE24F879BBCDB56FB6C91E0@spc2> <8362dvuixw.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=original Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1332925074 12757 80.91.229.3 (28 Mar 2012 08:57:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 28 Mar 2012 08:57:54 +0000 (UTC) Cc: 10980@debbugs.gnu.org To: "Eli Zaretskii" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 28 10:57:53 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 1SCohU-0004pI-Da for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Mar 2012 10:57:52 +0200 Original-Received: from localhost ([::1]:46708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCohT-0008UP-T7 for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Mar 2012 04:57:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCohN-0008Sn-R0 for bug-gnu-emacs@gnu.org; Wed, 28 Mar 2012 04:57:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCohL-00013x-Jv for bug-gnu-emacs@gnu.org; Wed, 28 Mar 2012 04:57:45 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCohL-00013d-GJ for bug-gnu-emacs@gnu.org; Wed, 28 Mar 2012 04:57:43 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SCpBd-0006kD-P9 for bug-gnu-emacs@gnu.org; Wed, 28 Mar 2012 05:29:01 -0400 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: Wed, 28 Mar 2012 09:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10980 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10980-submit@debbugs.gnu.org id=B10980.133292690825883 (code B ref 10980); Wed, 28 Mar 2012 09:29:01 +0000 Original-Received: (at 10980) by debbugs.gnu.org; 28 Mar 2012 09:28:28 +0000 Original-Received: from localhost ([127.0.0.1]:42251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SCpB5-0006jO-6I for submit@debbugs.gnu.org; Wed, 28 Mar 2012 05:28:28 -0400 Original-Received: from seluib4vp34.perspektivbredband.net ([81.186.254.26]:40215) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SCpAo-0006j2-Fr for 10980@debbugs.gnu.org; Wed, 28 Mar 2012 05:28:25 -0400 Original-Received: from spc2 (hd5b913e4.seluldx.dyn.perspektivbredband.net [213.185.19.228]) by seluib4vp34.perspektivbredband.net (Postfix) with SMTP id 0E51D604EC; Wed, 28 Mar 2012 10:56:48 +0200 (CEST) In-Reply-To: <8362dvuixw.fsf@gnu.org> 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-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-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:58227 Archived-At: >From: Eli Zaretskii >Sent: Friday, March 23, 2012 10:05 PM >> From: "Bo Johansson" >> Cc: <10980@debbugs.gnu.org> >> Date: Fri, 23 Mar 2012 21:20:23 +0100 >> >> Summary: A value in the variable initial-environment according to the >> documentation makes it possible to "get the same result doing somethin= g=20 >> from >> within Emacs as doing it from a Windows command prompt". >> >Is this only about SHELL, and only with dmake, or are there other >variables that get in the way of other programs? Please be specific; >the few changes done to the variables outside Emacs are done for a >good reason, so it's important to know the exact adverse effects of >that to judge how justified would it be to change the current code. Hej Eli! Here is some more information. I have looked in makefile using http://code.google.com/codesearch. SHELL = and=20 COMSPEC are frequently used. In some cases is even ComSpec used. To set SHELL to c:/Program Files (x86)/GNU Emacs 23.4/bin/cmdproxy.exe=20 causes a lot of problems. The resulting errors are often difficult to find. This partly because the= =20 warning messages given by cmdproxy.exe is often given without any context= . A program developed to run in Windows, expects a =E2=80=9CWindows environ= ment=E2=80=9D!? I have compared the environment variables in different situations. The=20 differences between the environment in Windows cmd.exe and the Emacs=20 variable initial-environment are: -ComSpec=3DC:\Windows\system32\cmd.exe +COMSPEC=3DC:\Windows\system32\cmd.exe +EMACSDATA=3Dc:/Program Files (x86)/GNU Emacs 23.4/etc +EMACSDOC=3Dc:/Program Files (x86)/GNU Emacs 23.4/etc +EMACSLOADPATH=3Dc:/Program Files (x86)/GNU Emacs 23.4/site-lisp;c:/Progr= am=20 Files (x86)/GNU Emacs 23.4/../site-lisp;c:/Program Files (x86)/GNU Emacs=20 23.4/lisp;c:/Program Files (x86)/GNU Emacs 23.4/leim +EMACSPATH=3Dc:/Program Files (x86)/GNU Emacs 23.4/bin +LANG=3DSVE -Path=3D... +PATH=3D... +SHELL=3Dc:/Program Files (x86)/GNU Emacs 23.4/bin/cmdproxy.exe +TMPDIR=3DC:\Users\bo\AppData\Local\Temp +emacs_dir=3Dc:/Program Files (x86)/GNU Emacs 23.4 Comspec and Path are renamed. SHELL is added and set to the cmdproxy.exe. Differences between initial-environment to shell-command environment are: +EM_PARENT_PROCESS_ID=3D... Differences initial-environment to compile environment are: +DISPLAY=3D +EMACS=3Dt +EM_PARENT_PROCESS_ID=3D... +INSIDE_EMACS=3Dt -TERM=3Ddumb +TERM=3Demacs +TERMCAP=3Demacs:co#80:tc=3Dunknown: This comment in emacs-git/src/w32.c:1778: /* Another special case: on NT, the PATH variable is actually named "Path" although cmd.exe (perhaps NT itself) arranges for environment variable lookup and setting to be case insensitive. However, Emacs assumes a fully case sensitive environment, so we need to change "Path" to "PATH" to match the expectations of various elisp packages. We do this by the sneaky method of modifying the string in the C runtime environ entry. The same applies to COMSPEC. */ indicates that changes to the environment are mainly? made for Emacs, NOT= =20 for the processes started by Emacs. Emacs should separate the "internal=20 environment" used internally by Emacs and the external used to set up=20 external processes!? My idea to get a read-only "inherited environment" is: 1) To save the "inherited environment" early in "c-code" at start up of=20 Emacs 2) Implement a lisp function which can return the saved "inherited=20 environment". The new read-only "inherited environment" can then later be used to start= =20 external processes with a more "transparent" environment. To start to change the current handling of the variable initial-environme= nt=20 is probably difficult and error prone.