unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: owner@emacsbugs.donarmstrong.com (Emacs bug Tracking System)
To: Juanma Barranquero <lekktu@gmail.com>
Subject: bug#2062: marked as done (PATH can contain non-expanded variables)
Date: Wed, 28 Jan 2009 15:15:03 +0000	[thread overview]
Message-ID: <handler.2062.D2062.123315522822609.ackdone@emacsbugs.donarmstrong.com> (raw)
In-Reply-To: f7ccd24b0901260500h18a7ac63uf5c88cbb515ddeb0@mail.gmail.com

[-- Attachment #1: Type: text/plain, Size: 906 bytes --]


Your message dated Wed, 28 Jan 2009 16:07:03 +0100
with message-id <f7ccd24b0901280707u39a4364bk76339f2e5956fa5@mail.gmail.com>
and subject line Re: bug#2062: PATH can contain non-expanded variables
has caused the Emacs bug report #2062,
regarding PATH can contain non-expanded variables
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
2062: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=2062
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 3265 bytes --]

From: Juanma Barranquero <lekktu@gmail.com>
To: Emacs Bug Tracker <submit@emacsbugs.donarmstrong.com>
Subject: PATH can contain non-expanded variables
Date: Mon, 26 Jan 2009 14:00:15 +0100
Message-ID: <f7ccd24b0901260500h18a7ac63uf5c88cbb515ddeb0@mail.gmail.com>

Package: emacs,w32
Version: 23.0.60

It is possible for PATH (or other path-like variables, like EMACSPATH
and EMACSLOADPATH) to contain unexpanded variables:

ELISP> exec-path
("c:/emacs/bin" "%MYTEST%" "C:/WINDOWS/system32" "C:/WINDOWS"
"C:/WINDOWS/system32/Wbem" "c:/emacs/trunk/bin")

for example, if the user has set
"HKLM\Microsoft\Windows\CurrentVersion\App Paths\emacs.exe\Path" as a
REG_EXPAND_SZ.

These variables should be expanded, but currently
emacs.c:decode_env_path does not. The following patch fixes it.

Comments?

    Juanma


Index: emacs.c
===================================================================
RCS file: /sources/emacs/emacs/src/emacs.c,v
retrieving revision 1.461
diff -u -2 -r1.461 emacs.c
--- emacs.c	23 Jan 2009 14:53:11 -0000	1.461
+++ emacs.c	26 Jan 2009 12:48:49 -0000
@@ -2467,6 +2467,12 @@
   if (path)
     {
+#ifdef WINDOWSNT
+      DWORD required = ExpandEnvironmentStrings (path, NULL, 0);
+      p = (char *) alloca (required);
+      ExpandEnvironmentStrings (path, p, required);
+#else
       p = alloca (strlen (path) + 1);
       strcpy (p, path);
+#endif
       path = p;



[-- Attachment #3: Type: message/rfc822, Size: 3903 bytes --]

From: Juanma Barranquero <lekktu@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 2062-close@emacsbugs.donarmstrong.com, Eli Zaretskii <eliz@gnu.org>, jasonr@f2s.com
Subject: Re: bug#2062: PATH can contain non-expanded variables
Date: Wed, 28 Jan 2009 16:07:03 +0100
Message-ID: <f7ccd24b0901280707u39a4364bk76339f2e5956fa5@mail.gmail.com>

On Wed, Jan 28, 2009 at 15:24, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> So your patch works around a bug in some other place which fails to
> expand PATH.

Not only you're right, but I know which program is causing the problem. Thanks!

According to MSDN KB 837633 (and other sources):

  Windows XP adds the path value, if it exists, to the PATH
environment variable,
  if you use the ShellExecute() function to start your program.

So, correctly, Windows Explorer uses App Paths, and CMD.EXE does not
(I've checked it).

The problem is with TCC (formerly 4NT), a proprietary command shell I
use. I had mistakenly assumed that TCC worked like CMD (or, in fact, I
did the reverse: because TCC adds App Paths to PATH, I assumed that
CMD also did it).

But it is not: apparently, TCC is adding App Paths to PATH (which is
either a bug or a feature, depending of one's POV), but it's not
taking into account that the App Paths entry can be REG_EXPAND_SZ (and
that's definitely a bug).

I'll report it to them.

    Juanma


      parent reply	other threads:[~2009-01-28 15:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <f7ccd24b0901280707u39a4364bk76339f2e5956fa5@mail.gmail.com>
2009-01-26 13:00 ` bug#2062: PATH can contain non-expanded variables Juanma Barranquero
2009-01-26 22:01   ` Lennart Borgman
2009-01-27  1:56   ` Jason Rumney
2009-01-27  8:34     ` Juanma Barranquero
2009-01-27  9:24       ` Jason Rumney
2009-01-27 10:25         ` Juanma Barranquero
2009-01-27 13:29           ` Jason Rumney
2009-01-27 14:42             ` Juanma Barranquero
2009-01-27 19:02             ` Stefan Monnier
2009-01-27 20:00               ` Juanma Barranquero
2009-01-28  8:39               ` Jason Rumney
2009-01-28  8:45                 ` Juanma Barranquero
2009-01-27 19:30           ` Eli Zaretskii
2009-01-27 19:55             ` Juanma Barranquero
2009-01-28  4:12               ` Eli Zaretskii
2009-01-28  8:36                 ` Juanma Barranquero
2009-01-28 14:24                   ` Stefan Monnier
2009-01-28 15:15   ` Emacs bug Tracking System [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=handler.2062.D2062.123315522822609.ackdone@emacsbugs.donarmstrong.com \
    --to=owner@emacsbugs.donarmstrong.com \
    --cc=lekktu@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).