From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-15?Q?G=FCnter_Rote?= Newsgroups: gmane.emacs.bugs Subject: cmdproxy.exe garbles special characters in environment variables Date: Sun, 24 Jun 2007 22:28:50 +0200 Message-ID: <467ED402.3090804@inf.fu-berlin.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1182759504 15282 80.91.229.12 (25 Jun 2007 08:18:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 25 Jun 2007 08:18:24 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 25 10:18:22 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I2jmA-00016F-0e for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jun 2007 10:18:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I2jm9-0003Ta-3f for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jun 2007 04:18:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I2Yhk-0001Kn-Tp for bug-gnu-emacs@gnu.org; Sun, 24 Jun 2007 16:29:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I2Yhk-0001Jk-9w for bug-gnu-emacs@gnu.org; Sun, 24 Jun 2007 16:29:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I2Yhk-0001JZ-7L for bug-gnu-emacs@gnu.org; Sun, 24 Jun 2007 16:29:04 -0400 Original-Received: from leibniz.math.fu-berlin.de ([160.45.40.10] helo=math.fu-berlin.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1I2Yhj-0000b3-Ks for bug-gnu-emacs@gnu.org; Sun, 24 Jun 2007 16:29:04 -0400 Original-Received: (qmail 17580 invoked from network); 24 Jun 2007 22:28:58 +0200 Original-Received: From argon.mi.fu-berlin.de (160.45.117.144) by leibniz.math.fu-berlin.de with (AES256-SHA encrypted) SMTP; 24 Jun 2007 20:28:58 -0000 Original-Received: from acb489a1.ipt.aol.com ([172.180.137.161] helo=[127.0.0.1]) by mail.mi.fu-berlin.de with esmtpsa (Exim 4.63 #1 (Debian)) id 1I2Yhe-0002AR-Qb for ; Sun, 24 Jun 2007 22:28:59 +0200 User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) X-Remote-IP: 172.180.137.161 X-detected-kernel: Solaris 9 X-Mailman-Approved-At: Mon, 25 Jun 2007 04:18:18 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:15992 Archived-At: 1) DESCRIPTION OF THE PROBLEM: After buying a new computer with Windows vista operating system and installing the latest emacs, I could no longer call LaTeX from emacs. (with the error message: "latex: The file system path could not be retrieved." 2) DIAGNOSIS: Since it worked, strangely, with other accounts on my computer, I eventually found the following reason: I am in the unlucky position that I have chosen an account name with an Umlaut. (Günter) cmdproxy.exe garbles these special characters in environment variables, thus causing TeX (I am using MIKTeX) to fail because it cannot access settings that are stored in my home directory: Here is a test run: ========================== Microsoft Windows [Version 6.0.6000] Copyright (c) 2006 Microsoft Corporation. Alle Rechte vorbehalten. C:\Users\Günter>set userprofile USERPROFILE=C:\Users\Günter C:\Users\Günter>"\Program Files\emacs-22.1\bin\cmdproxy.exe" Microsoft Windows [Version 6.0.6000] Copyright (c) 2006 Microsoft Corporation. Alle Rechte vorbehalten. C:\Users\Günter>set userprofile USERPROFILE=C:\Users\G?nter C:\Users\Günter>tex tex: The file system path could not be retrieved. C:\Users\Günter>set userprofile=C:\users\günter C:\Users\Günter>tex This is TeX, Version 3.141592 (MiKTeX 2.5) ** ============================== (In case this gets garbled by the mailer: the first USERPROFILE shows the umlaut (ü), the second one a question mark.) 3) POSSIBLE CAUSE: in the code for cmdproxy.exe on http://www.koders.com/c/fid9819664E76F7A0D978AEDF36E6B52EE58A477EC8.aspx?s=add#L379 contains the following snippet: /* In theory, passing NULL for the environment block to CreateProcess is the same as passing the value of GetEnvironmentStrings, but doing this explicitly seems to cure problems running DOS programs in some cases. */ char * envblock = GetEnvironmentStrings (); which is then passed to CreateProcess(...) Apparently there is a clash between different coding conventions. Here is some information that I found (I don't know with what system cmdproxy.c has been compiled) According to http://msdn2.microsoft.com/en-us/library/ms683187.aspx there are two versions of GetEnvironmentStrings: "Implemented as GetEnvironmentStringsW (Unicode) and GetEnvironmentStringsA (ANSI)." http://msdn2.microsoft.com/en-us/library/ms682425.aspx says about the lpEnvironment parameter of CreateProcess: An environment block can contain either Unicode or ANSI characters. If the environment block pointed to by lpEnvironment contains Unicode characters, be sure that dwCreationFlags includes CREATE_UNICODE_ENVIRONMENT. If this parameter is NULL and the environment block of the parent process contains Unicode characters, you must also ensure that dwCreationFlags includes CREATE_UNICODE_ENVIRONMENT. http://msdn2.microsoft.com/en-us/library/ms684863.aspx says about this flag: CREATE_UNICODE_ENVIRONMENT 0x00000400 If this flag is set, the environment block pointed to by lpEnvironment uses Unicode characters. Otherwise, the environment block uses ANSI characters. Windows Me/98/95: This value is not supported. [ 4) WORKAROUND. I have so far been using batch files for tex, latex, yap, etc. that set the environment variables before calling the programs themselves. I will try to compile a patched version of cmdproxy.exe that works for me. (It may mess up those DOS programs that are mentioned in cmdproxy.c ] This error has been a nuisance, and it took me a while to find the cause. Since it will only show up for few users, it will be difficult to diagnose. With best regards -- G"unter Rote (Germany=49)30-838-75150 (office) Freie Universit"at Berlin Institut f"ur Informatik FAX (49)30-838-75192 Takustrase 9 D-14195 Berlin, GERMANY