From unknown Sun Aug 17 22:03:15 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#2062 <2062@debbugs.gnu.org> To: bug#2062 <2062@debbugs.gnu.org> Subject: Status: PATH can contain non-expanded variables Reply-To: bug#2062 <2062@debbugs.gnu.org> Date: Mon, 18 Aug 2025 05:03:15 +0000 retitle 2062 PATH can contain non-expanded variables reassign 2062 emacs,w32 submitter 2062 Juanma Barranquero severity 2062 normal tag 2062 notabug thanks From lekktu@gmail.com Mon Jan 26 05:00:25 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 26 Jan 2009 13:00:25 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-5.9 required=4.0 tests=FOURLA,HAS_PACKAGE, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail-ew0-f10.google.com (mail-ew0-f10.google.com [209.85.219.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0QD0LVZ032728 for ; Mon, 26 Jan 2009 05:00:22 -0800 Received: by ewy3 with SMTP id 3so7135058ewy.1 for ; Mon, 26 Jan 2009 05:00:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=t2ivXmiO+1uL+J8pYlpX7NQQiKdP2JgbJlRYEQc58mw=; b=Xpl44wKZlyRcGkg+MmADaOINGG3Mr53T7OSdmyzBBHS5rqOIEgxANPUjdvYwVYnIHc 7ytpNvAygDpX6H/mtn7R1kQea9fL4flq9+o0PK5Sa/ZSL2/uhJeNIzhcmbp5otfx6+ZI bRfXDFCh2pyvC6d0eCPsU0N0wNLbL1Rp4cxUU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=bymMYHUEeOpi5IUCEvQ2LVqAZ1pc7o8zpv77bqgDdb37asYQFCu69yATbHN9meMJZM f1MLrbzu5KGJVNTigVEnzzjAxiddznTJ85H79TdeIds/ulSdI5KB/qd9s1C/MYm07QRx AgGVJyhPzYMPbqBb51W1pgCVhts/ItAXQi0nw= MIME-Version: 1.0 Received: by 10.210.130.14 with SMTP id c14mr3990754ebd.118.1232974815310; Mon, 26 Jan 2009 05:00:15 -0800 (PST) Date: Mon, 26 Jan 2009 14:00:15 +0100 Message-ID: Subject: PATH can contain non-expanded variables From: Juanma Barranquero To: Emacs Bug Tracker Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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; From lennart.borgman@gmail.com Mon Jan 26 14:01:18 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 26 Jan 2009 22:01:18 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.9 required=4.0 tests=FOURLA,GMAIL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.188]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0QM18H0009169; Mon, 26 Jan 2009 14:01:09 -0800 Received: by nf-out-0910.google.com with SMTP id 30so967136nfu.31 for ; Mon, 26 Jan 2009 14:01:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=jeHxQ+jM/1VNI4VDaNDFdH1bAOscuQ63HZz7u1Ys9Kw=; b=t725kBuw+uZVsSrhd2YqQm1yQjRBs9euD01iQYRrP3xtHc9Kl9O+JXOC2uE7NtJAga C+ZkhYMVHlctSDaLR9T/Bb+xDDoTO6hzUFUPl7NPXtFoJAvJkm4yXndQD7BgXKqO4TRf 1VwdO8ZIU+EL0JBmIwRi7ZomFxXx6LYOBL3m8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=vTJDvuWD2yGtI3Dvqoe729qLEwVdTzEiEb5pzu9LZ5/LMdT6D5MTCR0Tf3knjum1Sp D0Ss3qpLsGmS2GvAIiG0QzMX5lW/NZ2E3ObI9pjO3nlTRCLRg5l+gFN5PxnhjhXxoO1s PAo6fnpzDh030YY6bZ0Luto04qOQmQP3+5s5M= MIME-Version: 1.0 Received: by 10.86.80.17 with SMTP id d17mr419243fgb.55.1233007266000; Mon, 26 Jan 2009 14:01:06 -0800 (PST) In-Reply-To: References: Date: Mon, 26 Jan 2009 23:01:05 +0100 Message-ID: Subject: Re: bug#2062: PATH can contain non-expanded variables From: Lennart Borgman To: Juanma Barranquero , 2062@debbugs.gnu.org Cc: Emacs Bug Tracker Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Mon, Jan 26, 2009 at 2:00 PM, Juanma Barranquero wrote: > 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? Nice. Thanks. From jasonrumney@gmail.com Mon Jan 26 17:57:48 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 27 Jan 2009 01:57:48 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER autolearn=unavailable version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail-qy0-f20.google.com (mail-qy0-f20.google.com [209.85.221.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0R1vdTm003886; Mon, 26 Jan 2009 17:57:40 -0800 Received: by qyk13 with SMTP id 13so23211343qyk.1 for ; Mon, 26 Jan 2009 17:57:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=A8Mop3XEsZSQunh7v5OjH/b6so8exgIJUd6WtxguEnM=; b=QKvBTY+6WVq8hPCHYf1ImADtb7i+F3xWRKxy7aq3fzWaNpLqQc68CT0MIFE42+4dkb AFDEIZ3z0hV0F2V4g7UMsg5aY7votEbubZcOZ49sN7TD4S9fhRriw6ne2yA0k9z/oXCi x23MVt9ouohceWgiT2YJncY7vfkUctL/VFM9U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=jkIypeAW3t6tjSPNbPLmlcdErSojvZMSYvHNUvhuGFtiOHxELt13AWCMgl4CndfQiO eGPvoLJ/8I9/IebWs0M1jrsrraKKDq7x27iTQyWpoVXywOx7KUX5N/GBUY1tR9alf44e tifP/48N2KiuqD6THiqGp39ySs1RD9sEN7rHg= Received: by 10.214.148.1 with SMTP id v1mr1339076qad.194.1233021453857; Mon, 26 Jan 2009 17:57:33 -0800 (PST) Received: from ?192.168.249.26? ([118.101.26.137]) by mx.google.com with ESMTPS id 6sm906069qwk.52.2009.01.26.17.57.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 26 Jan 2009 17:57:32 -0800 (PST) Sender: Jason Rumney Message-ID: <497E69EB.70609@f2s.com> Date: Tue, 27 Jan 2009 09:56:59 +0800 From: Jason Rumney User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Juanma Barranquero , 2062@debbugs.gnu.org CC: Emacs Bug Tracker Subject: Re: bug#2062: PATH can contain non-expanded variables References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CrossAssassin-Score: 2 Juanma Barranquero wrote: > 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; > The right place to do this expansion is where the variable is read from the registry, and only when the type is REG_EXPAND_SZ. From lekktu@gmail.com Tue Jan 27 00:34:35 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 27 Jan 2009 08:34:35 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail-ew0-f10.google.com (mail-ew0-f10.google.com [209.85.219.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0R8YVFq007756 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 00:34:33 -0800 Received: by ewy3 with SMTP id 3so8138883ewy.1 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 00:34:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=udvZpUpj4+c3vdXyKf/+Jib7YMO+4yU1Ho5fUdP8Cz4=; b=HOKGZgI5wi2nawjbm6XNi2jMdB6aYaukWQuJcYPkvY4hHV+ksPpmQimk5BiBZyZ9UN 0NZhUQJ+SmJtbaCd3YLDqbbmwiEe6uMziH63x/ONEw2zK3Qc4hS4qbAySSafhI2keca1 fHe4lliVy9zlD7EJNgOuiXS+Rd1ApqIabMyYA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=VX7G+Gty663mKvvXKLsxGFgNX2ifgU7z7sApt9TKxQ9FjuebHf8xvdZjWGgzvBxix1 meB3r/dMsTj3Gjah0Q4feomCOiakkbesxLUlUk8z/ldSvwxi8snq7L4zziT4wDLg6V81 4qq8dk0W1ZI3N7Am06GdOLYwpCmGXW4r+jskQ= MIME-Version: 1.0 Received: by 10.210.66.13 with SMTP id o13mr5256914eba.21.1233045266162; Tue, 27 Jan 2009 00:34:26 -0800 (PST) In-Reply-To: <497E69EB.70609@f2s.com> References: <497E69EB.70609@f2s.com> Date: Tue, 27 Jan 2009 09:34:26 +0100 Message-ID: Subject: Re: bug#2062: PATH can contain non-expanded variables From: Juanma Barranquero To: Jason Rumney Cc: 2062@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Tue, Jan 27, 2009 at 02:56, Jason Rumney wrote: > The right place to do this expansion is where the variable is read from the > registry, and only when the type is REG_EXPAND_SZ. The problem is, we don't read "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\emacs.exe\Path", we find the PATH made for us and it contains unexpanded variables. My patch modifies decode_env_path, because it is used for PATH-like variables, not generic environment variables. How likely is that such a PATH-like variable contains a string like %VARIABLENAME%, meaning a literal "%VARIABLENAME%" directory or filename (or part of it)? That's a hypothetical problem, while my path containing such a variable is a fact. Juanma From jasonrumney@gmail.com Tue Jan 27 01:24:47 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 27 Jan 2009 09:24:47 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0R9OfS3020878 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 01:24:42 -0800 Received: by qw-out-2122.google.com with SMTP id 9so1444742qwb.13 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 01:24:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=5+TLVDsoBdpkDCaNFLUtPo/BlKNd1DXgtfGCVbuekT4=; b=Y/IyGpoRfd8VQdqYXzGVRlmEuVf4OzUEq77M9eOYIV3FjVCrwKS+Vcab/NUCil8Hfk OGQsrJ45r2WBlDzqTU2OC8ve/WI0bLnw1SQiWjh3vvL61TGeedcIJmKDNdF0kcTzI0yw hE1CxFvu9EGmeER2Ez6gnaoP7R6nY9NskJxi8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=UwpZtzYrtBpQhatZABzDnH+XfSnIIVEOeiAahXjwq1J1IKSbxRQSIjvfw94u8QQHBg WuoDmVvZjW181zY11dsCc/W+BxohJ3J5fIv7iEwKhY7GoyBOMKWS08tTE+RbzgBAZ51s H9XskS/KN7Zq73EpR65Ftu4vAyx5RCfReRcuE= Received: by 10.215.41.6 with SMTP id t6mr734437qaj.338.1233048281208; Tue, 27 Jan 2009 01:24:41 -0800 (PST) Received: from ?192.168.249.26? ([118.101.26.137]) by mx.google.com with ESMTPS id 5sm3149124yxt.11.2009.01.27.01.24.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 27 Jan 2009 01:24:40 -0800 (PST) Sender: Jason Rumney Message-ID: <497ED2B7.2080509@f2s.com> Date: Tue, 27 Jan 2009 17:24:07 +0800 From: Jason Rumney User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Juanma Barranquero CC: 2062@debbugs.gnu.org Subject: Re: bug#2062: PATH can contain non-expanded variables References: <497E69EB.70609@f2s.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Juanma Barranquero wrote: > On Tue, Jan 27, 2009 at 02:56, Jason Rumney wrote: > > >> The right place to do this expansion is where the variable is read from the >> registry, and only when the type is REG_EXPAND_SZ. >> > > The problem is, we don't read > "HKLM\Software\Microsoft\Windows\CurrentVersion\App > Paths\emacs.exe\Path", we find the PATH made for us and it contains > unexpanded variables. > If the system does not handle REG_EXPAND_SZ in the App Paths registry values, then the bug is with whatever incorrectly used that type when setting the registry value. From lekktu@gmail.com Tue Jan 27 02:25:30 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 27 Jan 2009 10:25:30 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail-ew0-f10.google.com (mail-ew0-f10.google.com [209.85.219.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0RAPQs0005002 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 02:25:28 -0800 Received: by ewy3 with SMTP id 3so8234041ewy.1 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 02:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=uGq/83CUBQdnEYqAthQ/PmYo9dSoig0H7jCUCrV/E54=; b=Nvz+o+Ky7rWHBTiScfNcJcSDJ0/nIjvzVIM2/ui/hujGcbL5bz5u6jr31W+id6dZzW lddFGjmkVDEUvcQv8ytgN4UO40oEOUome2jdoxfzvYUg4cF8gRZpp4GRJKV4f7P1U12i 5oB+USH4VpLOMWaD2Y/rxscZPzFsvdsdyUM64= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=NStCgTwWb2j1dBIcEBRrYleY4CMV2QceJ+vXNgso0pcjjal3DgICoPL+3dEdvsTIH5 8wX0vdiEoiUbsjHA54/7rd1bRcP7rtLlCMomcOkTuF265ckD+izJOtPiE837OUB3ZtK2 UDKrqInF4yjO7Bgb838RdJA92250c+m+N4LH4= MIME-Version: 1.0 Received: by 10.210.35.17 with SMTP id i17mr756298ebi.165.1233051920422; Tue, 27 Jan 2009 02:25:20 -0800 (PST) In-Reply-To: <497ED2B7.2080509@f2s.com> References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> Date: Tue, 27 Jan 2009 11:25:20 +0100 Message-ID: Subject: Re: bug#2062: PATH can contain non-expanded variables From: Juanma Barranquero To: Jason Rumney Cc: 2062@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Tue, Jan 27, 2009 at 10:24, Jason Rumney wrote: > If the system does not handle REG_EXPAND_SZ in the App Paths registry > values, then the bug is with whatever incorrectly used that type when > setting the registry value. I'd say that Microsoft is of two minds about it, judging by the entries for msimn.exe (Outlook Express), pbrush.exe (mspaint) and a few others, that do use REG_EXPAND_SZ. That said, ExpandEnvironmentStrings is not *specifically* for REG_EXPAND_SZ registry entries; it is generally useful for cases such as this one. So we can either: a) consider it as a bug outsize Emacs, and do nothing, or b) decide that a variable-like string of the form %VARIABLE% in a PATH-like value is much, much likely to be that, an unexpanded env var, than part of a file or directory name, and so expand it. I'm obviously in camp b), and would like to commit this patch. If you're strongly on camp a, though, I'll close this bug as notabug + wontfix. Juanma From jasonrumney@gmail.com Tue Jan 27 05:30:37 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 27 Jan 2009 13:30:37 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.25]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0RDUTPM019735 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 05:30:30 -0800 Received: by qw-out-2122.google.com with SMTP id 9so1484916qwb.13 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 05:30:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=4//WXtKu5ImGydiHNLezRPzc9ThkasLM18awhvGBlzo=; b=iYC4HtJfLSiZdKUSlUuEDo6n6xRPZ9Rh7Lv2ExdA0ye3+ot1eJLDFUcIjPCKm7D9hf W0u3qG1wDmUWReg47xTFJURFaYbLFVw32zboPKoIJyHyDoxzDqq5b+a5rv5zK4qCEIdI 5Tx98/W6lwO/ocSH3KLWi72ztz68ujFB3TUuo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=dKGyMDJAjfFZ4sY5xnsgVtLG2jR2UcyJwMuhLZhNBbXyyuSM4Wum7X/wsS69fJUiPe CMseDdP1vpDOKuwNSCgjbq8vMhSv7dS/sPC/nGmv8PGwmIIcOXxgyzmeZ8uo/D609Gh9 fwdBUABkkbZEqooCn0exqB0z50u+hGJYnKjsc= Received: by 10.214.11.11 with SMTP id 11mr1733880qak.308.1233063029257; Tue, 27 Jan 2009 05:30:29 -0800 (PST) Received: from ?192.168.249.26? ([118.101.26.137]) by mx.google.com with ESMTPS id 5sm15314609qwh.56.2009.01.27.05.30.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 27 Jan 2009 05:30:28 -0800 (PST) Sender: Jason Rumney Message-ID: <497F0C53.5090902@gnu.org> Date: Tue, 27 Jan 2009 21:29:55 +0800 From: Jason Rumney User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Juanma Barranquero CC: 2062@debbugs.gnu.org Subject: Re: bug#2062: PATH can contain non-expanded variables References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Juanma Barranquero wrote: > b) decide that a variable-like string of the form %VARIABLE% in a > PATH-like value is much, much likely to be that, an unexpanded env > var, than part of a file or directory name, and so expand it. > If we decide b, then why would we only decide that for Windows (syntax excepted)? From lekktu@gmail.com Tue Jan 27 06:42:33 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 27 Jan 2009 14:42:34 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.27]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0REgQU7006761 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 06:42:27 -0800 Received: by ey-out-2122.google.com with SMTP id 4so1030797eyf.13 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 06:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=3Vxuz6hod71drvWnIm6O1MZKJP9IzF80Tre0Qj1i8Fw=; b=J7auOJAhrBeBnayra49wCUbb5niNAX/nL3jSshssF/E2O//KVSaQnT3uPo5WocV4ts I52mXeLJZhrTPPQ1QqoOObcExX8XHTA84Ma1vQ8EN+OcMOmBjfN3zZ2h2DWBS9eYtA/I co0vOb+OOadXu3bmUrGdBU05+wctGEj5q6yi4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=ZhcXnEoijz6QdPip9lC0Hy/z6A+33zfAq2Au9+FkJ+WDzom5uEQOwCeX903MxcXlrP KV+CIGnbSvKttxmHbKPv/MirYbI2kkkUisN9xO1DfmFwB4ZAA6Hs3z0PrX3WRucdbnxA zQk21zBzJkX6j07cHzr2rhRvky4u3clgi9VYg= MIME-Version: 1.0 Received: by 10.210.61.11 with SMTP id j11mr242988eba.119.1233067345535; Tue, 27 Jan 2009 06:42:25 -0800 (PST) In-Reply-To: <497F0C53.5090902@gnu.org> References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> <497F0C53.5090902@gnu.org> Date: Tue, 27 Jan 2009 15:42:25 +0100 Message-ID: Subject: Re: bug#2062: PATH can contain non-expanded variables From: Juanma Barranquero To: Jason Rumney Cc: 2062@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Tue, Jan 27, 2009 at 14:29, Jason Rumney wrote: > If we decide b, then why would we only decide that for Windows (syntax > excepted)? No particular reason, except that REG_EXPAND_SZ exists, and so, having variables in PATH is not uncommon on Windows, while it is perhaps uncommon in other OSes. But that's no reason not to generalize it, if deemed useful, of course. Juanma From monnier@IRO.UMontreal.CA Tue Jan 27 11:02:33 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 27 Jan 2009 19:02:34 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from pruche.dit.umontreal.ca (pruche.dit.umontreal.ca [132.204.246.22]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0RJ2LSJ009333 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 11:02:22 -0800 Received: from alfajor.home (vpn-132-204-232-105.acd.umontreal.ca [132.204.232.105]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id n0RJ2uf6025067; Tue, 27 Jan 2009 14:02:56 -0500 Received: by alfajor.home (Postfix, from userid 20848) id 89B8D1C14C; Tue, 27 Jan 2009 14:02:11 -0500 (EST) From: Stefan Monnier To: Jason Rumney Cc: 2062@debbugs.gnu.org, Juanma Barranquero Subject: Re: bug#2062: PATH can contain non-expanded variables Message-ID: References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> <497F0C53.5090902@gnu.org> Date: Tue, 27 Jan 2009 14:02:11 -0500 In-Reply-To: <497F0C53.5090902@gnu.org> (Jason Rumney's message of "Tue, 27 Jan 2009 21:29:55 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3198=0 >> b) decide that a variable-like string of the form %VARIABLE% in a >> PATH-like value is much, much likely to be that, an unexpanded env >> var, than part of a file or directory name, and so expand it. > If we decide b, then why would we only decide that for Windows (syntax > excepted)? It looks like a situation where the variable expansion is expected to be done by the application under w32 (just like file globbing is not done by the shell there either), contrary to POSIX. So it's definitely not needed in GNU/Linux, and probably not in Mac OS X either. I cannot judge whether Juanma's patch is doing the right thing, or is working around some bug/misfeature elsewhere, or is really doing something wrong (it looks like the second option, tho). Stefan From eliz@gnu.org Tue Jan 27 11:30:46 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 27 Jan 2009 19:30:46 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.9 required=4.0 tests=FOURLA,GMAIL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout5.012.net.il (mtaout5.012.net.il [84.95.2.13]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0RJUgsi017258 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 11:30:44 -0800 Received: from conversion-daemon.i_mtaout5.012.net.il by i_mtaout5.012.net.il (HyperSendmail v2004.12) id <0KE500300A6A1700@i_mtaout5.012.net.il> for 2062@emacsbugs.donarmstrong.com; Tue, 27 Jan 2009 21:30:54 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.70.255.234]) by i_mtaout5.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0KE500G40A7HLMM2@i_mtaout5.012.net.il>; Tue, 27 Jan 2009 21:30:54 +0200 (IST) Date: Tue, 27 Jan 2009 21:30:41 +0200 From: Eli Zaretskii Subject: Re: bug#2062: PATH can contain non-expanded variables In-reply-to: X-012-Sender: halo1@inter.net.il To: Juanma Barranquero , 2062@debbugs.gnu.org Cc: jasonr@f2s.com Reply-to: Eli Zaretskii Message-id: References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> > From: Juanma Barranquero > Cc: 2062@emacsbugs.donarmstrong.com > > On Tue, Jan 27, 2009 at 10:24, Jason Rumney wrote: > > > If the system does not handle REG_EXPAND_SZ in the App Paths registry > > values, then the bug is with whatever incorrectly used that type when > > setting the registry value. > > I'd say that Microsoft is of two minds about it, judging by the > entries for msimn.exe (Outlook Express), pbrush.exe (mspaint) and a > few others, that do use REG_EXPAND_SZ. > > That said, ExpandEnvironmentStrings is not *specifically* for > REG_EXPAND_SZ registry entries; it is generally useful for cases such > as this one. What was the use-case that caused Path to include unexpanded environment variables in your case? From lekktu@gmail.com Tue Jan 27 11:55:50 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 27 Jan 2009 19:55:50 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail-ew0-f10.google.com (mail-ew0-f10.google.com [209.85.219.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0RJtkMF023248 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 11:55:47 -0800 Received: by ewy3 with SMTP id 3so9090240ewy.1 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 11:55:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=E4Tv0VqNyDlu3OPgMmzqEWVJwdB/8cio3DgmsJ52iKM=; b=Yguf1aUBgCVmHRoYNPZQsad6HWKP7B+Nf7JnyQHOkJRsgzA5C5Zk62/yybAWU7Oy9W sEM6SqzWE1yC/iaunZl3KLRSt97Xe3wHaJIauZEMM7g8M1fBgPoyFQ1Q65QiC4f4QG9C 1tE0yPoXLiVPc/dwIrLdyIPadPoBwQcem36pY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=bxGr0BJz3843M/zg5d1HDEy3c7jv7Od0eUS4ltcFvt9PS35WnBmwpUWgXPI7qghuVJ qvVIW6LbUErFer0PFBk24xIBN5tnpARW4lFBZEsX7RCc9jfbI8x1p2tYFtDK3rxoJFi4 wxFnUllNFYU4I3C7qTfHf5Ss8qC6VXLkIyjYA= MIME-Version: 1.0 Received: by 10.210.76.4 with SMTP id y4mr77688eba.176.1233086109900; Tue, 27 Jan 2009 11:55:09 -0800 (PST) In-Reply-To: References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> Date: Tue, 27 Jan 2009 20:55:09 +0100 Message-ID: Subject: Re: bug#2062: PATH can contain non-expanded variables From: Juanma Barranquero To: Eli Zaretskii Cc: 2062@debbugs.gnu.org, jasonr@f2s.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Tue, Jan 27, 2009 at 20:30, Eli Zaretskii wrote: > What was the use-case that caused Path to include unexpanded > environment variables in your case? In *my* case, I run several instances of Emacs, and I put different binaries (image libraries, etc.) in several directories, pointed to by one environment variable. I always start Emacs from the command line, and I set the environment variable according to which Emacs I want to run and what additional binaries to use. I have the App Path set to C:\emacs\%myvar%\bin, where %myvar% points to the relevant dir. But my use case is not important: there are many ways to do what I do, and I'm not even claiming mine is optimal, or close to it. If I want to fix that (or work around it, if it is a Windows bug) is because certainly there's nothing precluding the user from setting a REG_EXPAND_SZ for PATH, or EMACSPATH or EMACSLOADPATH, and there seems to be no downside to this change, unless we deem C:\this\is%myweird%path\to\file likely. But this does not merit too long a discussion IMO. Either you (all) think it's useful, or hackish. Your call. Juanma From lekktu@gmail.com Tue Jan 27 12:00:51 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 27 Jan 2009 20:00:51 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.27]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0RK0lx5024482 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 12:00:49 -0800 Received: by ey-out-2122.google.com with SMTP id 4so1084903eyf.13 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 12:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=HPZkfpLLUCVkmu8VvQ76Rs+4L4pSmoT2GUlWXj4od0A=; b=ot5UGLZs2CHSyNkIhPU2Y8OVx0qzv0TH0oMLmTelUGfUCYxRT1JcVKscvCK5SExa95 MHnRCg/Uww9lQwm3CpmFWL5PXnYYsNOb2DkzHcSqUTpBw+IpkVyItQx/vwZwTMVRq5fe YZtxdctYisryLj5TEmH/O0LY5IdjzI9kZ00yk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=i6fgxbeDR2WtAYCI91pgBndNQ9mGxOlqVFs7nPJz4gxJpKsMqp9XbCCira5BIaAUvS +15E1kZP8FD+CjkgIUNrHktqwor3Dh4C8g6t8DqSKYVWAHpzYsaGHxcAt7tbK4d8H6DD qsoptm+N6fJWcdDDMJqroqAHnfESjDcdFqu04= MIME-Version: 1.0 Received: by 10.210.34.5 with SMTP id h5mr5794541ebh.161.1233086447113; Tue, 27 Jan 2009 12:00:47 -0800 (PST) In-Reply-To: References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> <497F0C53.5090902@gnu.org> Date: Tue, 27 Jan 2009 21:00:47 +0100 Message-ID: Subject: Re: bug#2062: PATH can contain non-expanded variables From: Juanma Barranquero To: Stefan Monnier Cc: Jason Rumney , 2062@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Tue, Jan 27, 2009 at 20:02, Stefan Monnier wrote: > I cannot judge whether Juanma's patch is doing the right > thing, or is working around some bug/misfeature elsewhere, or is really > doing something wrong (it looks like the second option, tho). I think my patch works around a underspecified part of PATH processing. In my quite-informal tests, it seems like App Path expansion is done, or not done, differently for different command shells, and also depends on whether you run the program from CMD or the Windows Explorer shell. Juanma From eliz@gnu.org Tue Jan 27 20:13:18 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 28 Jan 2009 04:13:18 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.9 required=4.0 tests=FOURLA,GMAIL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout5.012.net.il (mtaout5.012.net.il [84.95.2.13]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0S4DB3M019092 for <2062@emacsbugs.donarmstrong.com>; Tue, 27 Jan 2009 20:13:13 -0800 Received: from conversion-daemon.i_mtaout5.012.net.il by i_mtaout5.012.net.il (HyperSendmail v2004.12) id <0KE500A00Y78BE00@i_mtaout5.012.net.il> for 2062@emacsbugs.donarmstrong.com; Wed, 28 Jan 2009 06:12:50 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.70.255.234]) by i_mtaout5.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0KE500JNWYDDB9C1@i_mtaout5.012.net.il>; Wed, 28 Jan 2009 06:12:50 +0200 (IST) Date: Wed, 28 Jan 2009 06:12:37 +0200 From: Eli Zaretskii Subject: Re: bug#2062: PATH can contain non-expanded variables In-reply-to: X-012-Sender: halo1@inter.net.il To: Juanma Barranquero Cc: 2062@debbugs.gnu.org, jasonr@f2s.com Reply-to: Eli Zaretskii Message-id: References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> > Date: Tue, 27 Jan 2009 20:55:09 +0100 > From: Juanma Barranquero > Cc: 2062@emacsbugs.donarmstrong.com, jasonr@f2s.com > > But this does not merit too long a discussion IMO. Either you (all) > think it's useful, or hackish. Your call. I was trying to understand how come a variable is stored in the Registry with incorrect REG_EXPAND_SZ, and how often that happens. Is that true that in your case it is simply a user mistake? From jasonrumney@gmail.com Wed Jan 28 00:39:48 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 28 Jan 2009 08:39:48 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.175]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0S8djCr020709 for <2062@emacsbugs.donarmstrong.com>; Wed, 28 Jan 2009 00:39:46 -0800 Received: by wf-out-1314.google.com with SMTP id 26so7924700wfd.13 for <2062@emacsbugs.donarmstrong.com>; Wed, 28 Jan 2009 00:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=CPgj1a8LWJ0uKOexzzqIBPcQjv1tNy2Jfh7sHKJapyU=; b=Msc7UaCw13HJopLPHMiHkX51ZX2azREUK/51IEwJkIZY1PQylZFCN9oRWaJYEo+lmi 1tYINp4aBPyrlSdKBnYPeJfkrG/tFWrb3aWFqWQ/u/Iplo4SVjI/XFqkUN8mgsTYYZy6 S9x0dCjIqlBQRMf6KBeIgfGGhQ0B2IiWW+ctw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=gckX1xLbGW2QEaC+dhs1fPi0d8Ewl03n4/xj8kFgisgcctrjCtc/DKT3xc8VgDoxMf j7nsuxQYzQv8qqk1ha4aTc184ycEy2xq7ibsmOeSCZP53wYe3DOUG3vNQc1M8YkYl5l7 is/67GKkJ+nfHqwBahKCpgkaLoFXtTqMlnn1M= Received: by 10.143.6.19 with SMTP id j19mr3693849wfi.128.1233131984974; Wed, 28 Jan 2009 00:39:44 -0800 (PST) Received: from ?192.168.249.26? ([118.101.26.137]) by mx.google.com with ESMTPS id 22sm19917653wfd.13.2009.01.28.00.39.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 28 Jan 2009 00:39:44 -0800 (PST) Sender: Jason Rumney Message-ID: <498019AE.5020805@gnu.org> Date: Wed, 28 Jan 2009 16:39:10 +0800 From: Jason Rumney User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Stefan Monnier CC: 2062@debbugs.gnu.org, Juanma Barranquero Subject: Re: bug#2062: PATH can contain non-expanded variables References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> <497F0C53.5090902@gnu.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Stefan Monnier wrote: > It looks like a situation where the variable expansion is expected to be > done by the application under w32 (just like file globbing is not done > by the shell there either), contrary to POSIX. > Environment variables are expanded in PATH when set as an environment variable on Windows. Only when using this undocumented registry entry to set an application specific path does the expansion apparently not happen. From lekktu@gmail.com Wed Jan 28 00:43:20 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 28 Jan 2009 08:43:20 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail-ew0-f10.google.com (mail-ew0-f10.google.com [209.85.219.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0S8hCXx021895 for <2062@emacsbugs.donarmstrong.com>; Wed, 28 Jan 2009 00:43:13 -0800 Received: by ewy3 with SMTP id 3so9514720ewy.1 for <2062@emacsbugs.donarmstrong.com>; Wed, 28 Jan 2009 00:43:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=vUtHKMHBAmwvVAcGvPliQYMLq1jC6epp4dEUbDzEMCc=; b=LOgqcxRA7IB+fYuzlqQxy71Ie9yExX5WkJGnnN1dSfmwmPPeZPNuvbrjBmwaWW+8AB 2z21wdvd7LNpHzsyjlQfGM1uwwPCwQ3qLRHxs0DUVk2ldEJwqVXK/riKtwjkPsZvF8IO NrnaUq94KTJviUhjJHVXiw37i3X2g7pk2DZR4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=FAfkIgVMaip/iwVDgwrvW4ejBqLEwbGpIfmn4WHzZzUtc6KEOBdeggCu4PQGR4ofsZ MxFzpBDQvKOfRZY6gESElGvRjnxI1mxb2a1kP8y4j01pLm4tpBAzMTvSdKbdno/+uPHu KZlEtUoFjyLxhw4vbiZ7MDhI15sLlad4jwOos= MIME-Version: 1.0 Received: by 10.67.15.15 with SMTP id s15mr2443852ugi.39.1233131815682; Wed, 28 Jan 2009 00:36:55 -0800 (PST) In-Reply-To: References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> Date: Wed, 28 Jan 2009 09:36:55 +0100 Message-ID: Subject: Re: bug#2062: PATH can contain non-expanded variables From: Juanma Barranquero To: Eli Zaretskii Cc: 2062@debbugs.gnu.org, jasonr@f2s.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Wed, Jan 28, 2009 at 05:12, Eli Zaretskii wrote: > I was trying to understand how come a variable is stored in the > Registry with incorrect REG_EXPAND_SZ, and how often that happens. Is > that true that in your case it is simply a user mistake? Of course not. It was done on purpose, if that's what you're asking. But I don't see anything that suggests that REG_EXPAND_SZ is not valid for App Path entries. In fact, Microsoft adds such entries, and perusing the MSDN seems to indicate that they are indeed valid. Not only that: if I start Emacs from a desktop shortcut (and, thus, through ShellExecute), App Paths is correctly expanded. Juanma From lekktu@gmail.com Wed Jan 28 00:46:06 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 28 Jan 2009 08:46:06 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail-ew0-f10.google.com (mail-ew0-f10.google.com [209.85.219.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0S8k2kA023138 for <2062@emacsbugs.donarmstrong.com>; Wed, 28 Jan 2009 00:46:04 -0800 Received: by ewy3 with SMTP id 3so9516330ewy.1 for <2062@emacsbugs.donarmstrong.com>; Wed, 28 Jan 2009 00:45:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ezQT2TykyiEmRGKF2b0RzGs12NraVUCrEz0DlxN0GXs=; b=U2UENczWrRZIjMrxhxZaTCHlaMYErzMDbBpBgznpZWzxp7yzSXC7/dEXpVzZ6pCcfx k7Hz+WGxWcNpmsda3WPFpApnsn6S+GPi7cJII9w5hU+UHkHdTwfmvRPOFP3efiKkh8Op H50t5+n6PimPxqypOkT4f6q1rWeESnZviTMRs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=EiIS0ZkG1ctPKuqFIh6j0MAqP7tWGPs/1WQHGsF+B16Ccgl9ZC1LH9dxex+8lFDNvI XH0oJH5U4DIw7f+NBohABr0eXyy/MejO0MY5qqlxbPll/XR/L3OkV4scXSvka1L+FRMR hijXHWii+dxctnydyVFiNsG30JkhxvNfgQkOU= MIME-Version: 1.0 Received: by 10.66.232.10 with SMTP id e10mr2445642ugh.70.1233132356231; Wed, 28 Jan 2009 00:45:56 -0800 (PST) In-Reply-To: <498019AE.5020805@gnu.org> References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> <497F0C53.5090902@gnu.org> <498019AE.5020805@gnu.org> Date: Wed, 28 Jan 2009 09:45:56 +0100 Message-ID: Subject: Re: bug#2062: PATH can contain non-expanded variables From: Juanma Barranquero To: Jason Rumney Cc: Stefan Monnier , 2062@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Wed, Jan 28, 2009 at 09:39, Jason Rumney wrote: > Only when using this undocumented registry entry [...] Underdocumented, or badly documented, perhaps. Undocumented is not: http://msdn.microsoft.com/en-us/library/cc144150(VS.85).aspx Juanma From monnier@iro.umontreal.ca Wed Jan 28 06:24:53 2009 Received: (at 2062) by emacsbugs.donarmstrong.com; 28 Jan 2009 14:24:53 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-0.4 required=4.0 tests=FOURLA,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8,XIRONPORT autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.teksavvy.com (ironport2-out.teksavvy.com [206.248.154.182]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0SEOnVH011031 for <2062@emacsbugs.donarmstrong.com>; Wed, 28 Jan 2009 06:24:50 -0800 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuwEABP5f0nO+LLC/2dsb2JhbACBbso+hUcGgjw X-IronPort-AV: E=Sophos;i="4.37,338,1231131600"; d="scan'208";a="32920887" Received: from 206-248-178-194.dsl.teksavvy.com (HELO pastel.home) ([206.248.178.194]) by ironport2-out.teksavvy.com with ESMTP; 28 Jan 2009 09:24:45 -0500 Received: by pastel.home (Postfix, from userid 20848) id 4C1CF8120; Wed, 28 Jan 2009 09:24:43 -0500 (EST) From: Stefan Monnier To: Juanma Barranquero Cc: 2062@debbugs.gnu.org, Eli Zaretskii , jasonr@f2s.com Subject: Re: bug#2062: PATH can contain non-expanded variables Message-ID: References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> Date: Wed, 28 Jan 2009 09:24:43 -0500 In-Reply-To: (Juanma Barranquero's message of "Wed, 28 Jan 2009 09:36:55 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > Not only that: if I start Emacs from a desktop shortcut (and, thus, > through ShellExecute), App Paths is correctly expanded. So your patch works around a bug in some other place which fails to expand PATH. Stefan From lekktu@gmail.com Wed Jan 28 07:07:08 2009 Received: (at 2062-close) by emacsbugs.donarmstrong.com; 28 Jan 2009 15:07:08 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.9 required=4.0 tests=FOURLA,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.25]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0SF74Ex022603 for <2062-close@emacsbugs.donarmstrong.com>; Wed, 28 Jan 2009 07:07:05 -0800 Received: by ey-out-2122.google.com with SMTP id 22so27310eye.13 for <2062-close@emacsbugs.donarmstrong.com>; Wed, 28 Jan 2009 07:07:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=3KpZQpnFC2kle7i7gRdEKLc2CZQQ71e0A7IxNa3jzVI=; b=Hm+jIW2yLzaF0SimowjEiWTtAYyi4X/8ZNTsRcpqhmVplRL7d4ep7oNukqwk1Bo0Ld IHFH8pwrhRiH8ZzqF/aYSqvHw6Weh7n8ukC1J/vJg+i+frw+W3uwd6mi4+4p1lG+JyZ5 cd7zpVZcB2XBWA4oZ16fohn6unqulXwSURxOg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=sBFX46ihuEKulXSQOUOprl/IjoVhoY2vtw0R99ja3WrtQcW90b69yzjA8hzlAOD2vk bTV+UQUK4TNOrb6RypFSp+TOWepJrBT3fnduOXg+kKkcrMsX1m/QwtninyxotjeQmCY+ dgplHrC2A21/v8cuv9uzAmDy2dEoCFAJ/77Oc= MIME-Version: 1.0 Received: by 10.66.248.5 with SMTP id v5mr560300ugh.4.1233155223576; Wed, 28 Jan 2009 07:07:03 -0800 (PST) In-Reply-To: References: <497E69EB.70609@f2s.com> <497ED2B7.2080509@f2s.com> Date: Wed, 28 Jan 2009 16:07:03 +0100 Message-ID: Subject: Re: bug#2062: PATH can contain non-expanded variables From: Juanma Barranquero To: Stefan Monnier Cc: 2062-close@debbugs.gnu.org, Eli Zaretskii , jasonr@f2s.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Wed, Jan 28, 2009 at 15:24, Stefan Monnier 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 From lekktu@gmail.com Wed Jan 28 07:37:23 2009 Received: (at control) by emacsbugs.donarmstrong.com; 28 Jan 2009 15:37:23 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: ** X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=2.3 required=4.0 tests=MISSING_SUBJECT,NOSUBJECT, VALID_BTS_CONTROL autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from ik-out-1112.google.com (ik-out-1112.google.com [66.249.90.180]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0SFbKVe030036 for ; Wed, 28 Jan 2009 07:37:21 -0800 Received: by ik-out-1112.google.com with SMTP id b32so1904993ika.1 for ; Wed, 28 Jan 2009 07:37:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=7dJXyFySO6Nevyz0jxiepJqlRyj2zgyUpgLd3KtPwFg=; b=j3qF9HCNk3d0M6ra4yUcTYbith47bfhrC9dyMHE/o38IHYMSxmGRfnkRfrooNiAEPm W7yx/bPwiScwRrcUoRw+gL8obU22LgCHohAfAmRGm2dGmhNRJSUij9GRVSzZiXLM90ne 1q9kyJ4RG+3YaScy4AaIOW1uzSB75AZbM2GSA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=gn6RvVXEG5S08u0vlslG7JLXoFp6m1mkYgKHIOJupLY079HhUSc/nHvAPfAeGSeNJA ItUILGFndnNcFZ0S7AQHiTRiYRmwIlALJ9JsavL308YcNyizppbPZU/VTManuCcJUfYk JIjLsbNV6chQ2vgfRqOeFsC9fEyuiRKQKGBf0= MIME-Version: 1.0 Received: by 10.67.116.19 with SMTP id t19mr116227ugm.55.1233157039658; Wed, 28 Jan 2009 07:37:19 -0800 (PST) Date: Wed, 28 Jan 2009 16:37:19 +0100 Message-ID: Subject: From: Juanma Barranquero To: control@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit tags 2062 + notabug quit From unknown Sun Aug 17 22:03:15 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: $requester Subject: Internal Control Message-Id: bug archived. Date: Thu, 26 Feb 2009 15:24:06 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A log time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator