From unknown Sat Jun 14 17:59:14 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#4823 <4823@debbugs.gnu.org> To: bug#4823 <4823@debbugs.gnu.org> Subject: Status: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths: Reply-To: bug#4823 <4823@debbugs.gnu.org> Date: Sun, 15 Jun 2025 00:59:14 +0000 retitle 4823 w32 paths `substitute-in-file-name' fails when environmental v= ariable is set for \\ style paths: reassign 4823 emacs submitter 4823 MON KEY severity 4823 normal thanks From stan@derbycityprints.com Wed Oct 28 13:19:52 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 28 Oct 2009 20:19:52 +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.5 required=4.0 tests=AWL,MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n9SKJpSU019206 for ; Wed, 28 Oct 2009 13:19:52 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N3Ezm-00044U-Ew for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2009 16:19:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N3Ezh-0003zS-Nd for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2009 16:19:50 -0400 Received: from [199.232.76.173] (port=43737 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N3Ezh-0003zE-E5 for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2009 16:19:45 -0400 Received: from mail-yx0-f191.google.com ([209.85.210.191]:57539) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N3Ezh-0006zV-5B for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2009 16:19:45 -0400 Received: by yxe29 with SMTP id 29so1038043yxe.14 for ; Wed, 28 Oct 2009 13:19:44 -0700 (PDT) MIME-Version: 1.0 Sender: stan@derbycityprints.com Received: by 10.150.253.21 with SMTP id a21mr29892760ybi.157.1256761184183; Wed, 28 Oct 2009 13:19:44 -0700 (PDT) Date: Wed, 28 Oct 2009 16:19:44 -0400 X-Google-Sender-Auth: 6148b3bc07092b36 Message-ID: Subject: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths: From: MON KEY To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths: ;; :SITUATION-1 w/out trailing `\\' (setenv "HOME2" "C:\\home\\me") (getenv "HOME2") ;=> "C:\\home\\me" (substitute-in-file-name "$HOME2\\.emacs") ;=> "C:\\home\\me/emacs" (substitute-in-file-name "$HOME2/.emacs") ;=>"C:\\home\\me/.emacs" (substitute-in-file-name "$HOME2.emacs") ;=> "C:\\home\\me.emacs" ;; :SITUATION-2 with trailing `\\' (setenv "HOME2" "C:\\home\\me\\") (getenv "HOME2") ;=> "C:\\home\\me\\" (substitute-in-file-name "$HOME2\\.emacs") ;=> "/.emacs" (substitute-in-file-name "$HOME2\.emacs") ;=> "C:\\home\\me\\.emacs" (substitute-in-file-name "$HOME2//.emacs") ;=> "/.emacs" (substitute-in-file-name "$HOME2.emacs") ;=> "C:\\home\\me\\.emacs" ;; ON FOLLOWING SYSTEM: GNU Emacs 23.1.50.1 (i386-mingw-nt5.1.2600) of 2009-06-30 on LENNART-69DE564 (patched) From lekktu@gmail.com Wed Oct 28 14:39:01 2009 Received: (at 4823) by emacsbugs.donarmstrong.com; 28 Oct 2009 21:39:02 +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.5 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail-bw0-f227.google.com (mail-bw0-f227.google.com [209.85.218.227]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n9SLcxnh027191 for <4823@emacsbugs.donarmstrong.com>; Wed, 28 Oct 2009 14:39:01 -0700 Received: by bwz27 with SMTP id 27so1844521bwz.1 for <4823@emacsbugs.donarmstrong.com>; Wed, 28 Oct 2009 14:38:54 -0700 (PDT) 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 :from:date:message-id:subject:to:cc:content-type; bh=jOWkzKZ7c1S5s5xfUtz5Ehm2CvqY9izYdefjQhhZ770=; b=VI+bI9vmzajynLdJciIQt4XO7dLnK3Pk1WHbmkW9fdWSbFIw5jzHNvGhV78RvMNQS5 q+bjXxuIesaIub9CaaJZx1Imv60ZHFuecA0n7VIdnqRPPdgkuwC4dHCjDjTqYRqiCy2m OBnYQWkoj173kVi8R8Jl84Awbg4sI8pSrrBVY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=sqX7YwEN/A+ULs4g/twCKPONzaWA7TOSWEwBmXaihYR1ZESe0olY8bUh/cKKQ0zAF3 aXy+EQJ52yRa2gY+GNKLZj5kelZsdyZQvLscgGa+OkfOuh+EejwMWhoSa5PFo3yNyVdb iiq4mOXWAX2gvJ3EywCsx7UyWHdDz9obGnSxU= MIME-Version: 1.0 Received: by 10.204.48.212 with SMTP id s20mr1986623bkf.101.1256765934148; Wed, 28 Oct 2009 14:38:54 -0700 (PDT) In-Reply-To: References: From: Juanma Barranquero Date: Wed, 28 Oct 2009 22:38:34 +0100 Message-ID: Subject: Re: bug#4823: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths: To: MON KEY Cc: 4823@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 On Wed, Oct 28, 2009 at 21:19, MON KEY wrote: > ;; :SITUATION-1 w/out trailing `\\' > (substitute-in-file-name "$HOME2\\.emacs") > ;=> "C:\\home\\me/emacs" I get "C:\\home\\me/.emacs", which seems correct. > (substitute-in-file-name "$HOME2/.emacs") > ;=>"C:\\home\\me/.emacs" > (substitute-in-file-name "$HOME2.emacs") > ;=> "C:\\home\\me.emacs" These seem correct to me. > ;; :SITUATION-2 with trailing `\\' > (substitute-in-file-name "$HOME2\\.emacs") > ;=> "/.emacs" $HOME2\\.emacs ==> "C:\\home\\me\\\\.emacs" ==> C:\home\me\\.emacs According to the docstring of `substitute-in-file-name': If `//' appears, everything up to and including the first of those `/' is discarded. and \\ (quoted to \\\\) is equivalent to // in w32 filenames (at least for Emacs). > (substitute-in-file-name "$HOME2\.emacs") > ;=> "C:\\home\\me\\.emacs" $HOME2\.emacs ==> "C:\\home\\me\\\.emacs" ==> C:\home\me\.emacs so this is correct (remember that "\." == "."). > (substitute-in-file-name "$HOME2//.emacs") > ;=> "/.emacs" This is similar to the \\\\ case above: $HOME2//.emacs ==> "C:\\home\\me\\//.emacs" ==> C:\home\me\//.emacs which could arguably be //.emacs, but that does not seem very useful. > (substitute-in-file-name "$HOME2.emacs") > ;=> "C:\\home\\me\\.emacs" That seems correct. What where you expecting in each case? Juanma From monnier@iro.umontreal.ca Wed Oct 28 17:43:40 2009 Received: (at 4823) by emacsbugs.donarmstrong.com; 29 Oct 2009 00:43:40 +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=-3.2 required=4.0 tests=AWL,FOURLA,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.pppoe.ca (ironport2-out.teksavvy.com [206.248.154.181]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n9T0hcKg012609 for <4823@emacsbugs.donarmstrong.com>; Wed, 28 Oct 2009 17:43:39 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqgEAPSB6EpLd/xb/2dsb2JhbACBT9l5hD8EiEs X-IronPort-AV: E=Sophos;i="4.44,642,1249272000"; d="scan'208";a="48337473" Received: from 75-119-252-91.dsl.teksavvy.com (HELO pastel.home) ([75.119.252.91]) by ironport2-out.pppoe.ca with ESMTP; 28 Oct 2009 20:43:33 -0400 Received: by pastel.home (Postfix, from userid 20848) id 0B57A8013; Wed, 28 Oct 2009 20:43:33 -0400 (EDT) From: Stefan Monnier To: Juanma Barranquero Cc: 4823@debbugs.gnu.org, MON KEY Subject: Re: bug#4823: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths: Message-ID: References: Date: Wed, 28 Oct 2009 20:43:33 -0400 In-Reply-To: (Juanma Barranquero's message of "Wed, 28 Oct 2009 22:38:34 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > According to the docstring of `substitute-in-file-name': > If `//' appears, everything up to and including the first of > those `/' is discarded. Admittedly, I think substitute-in-file-name implements this feature incorrectly, because the double-slash handling should be done before envvar expansion (envvars ceom from outside Emacs usually, so they generally rely on the convention that /foo///bar is equivalent to /foo/bar rather than to /bar). OTOH if an envvar holds "http://foo/bar", then we'd want to use url-handler-mode's implementation of substitute-in-file-name, which would argue for doing expansion early. It's probably tricky to get it to do the right thing in "all" cases. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 01 21:40:42 2011 Received: (at 4823) by debbugs.gnu.org; 2 Jul 2011 01:40:42 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QcpCM-0001VI-1T for submit@debbugs.gnu.org; Fri, 01 Jul 2011 21:40:42 -0400 Received: from mail-pz0-f50.google.com ([209.85.210.50]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QcpCK-0001V7-Dx for 4823@emacsbugs.donarmstrong.com; Fri, 01 Jul 2011 21:40:41 -0400 Received: by pzk2 with SMTP id 2so1209888pzk.37 for <4823@emacsbugs.donarmstrong.com>; Fri, 01 Jul 2011 18:40:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=xMphp3/Th/1lhEfxzc4Q0jfhxQd04fwD4FJc2JN0ik8=; b=M24Xqmr6mrDPZ2ByqeH4p9X38cx1AGbpB5mI60VzM96hZamOYhwmZ0xIRFAcsVcx/L oLQGeyCQuwAolCtGtFFqHKV13kxaFzfaSkvHMdFKtFQEO11Gu/rM9DNbtUJBjx7PMipV dn+L+wdHdhgykI/8nVXZFmw8ssi7njl+wwNHM= Received: by 10.143.66.15 with SMTP id t15mr1635197wfk.278.1309570834145; Fri, 01 Jul 2011 18:40:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.50.7 with HTTP; Fri, 1 Jul 2011 18:39:54 -0700 (PDT) In-Reply-To: References: From: Juanma Barranquero Date: Sat, 2 Jul 2011 03:39:54 +0200 Message-ID: Subject: Re: bug#4823: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths: To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 4823 Cc: 4823@debbugs.gnu.org, MON KEY X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.3 (-) I'm closing this one because the original reported behavior is not a bug, and there's nothing else to do. =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 01 21:48:05 2011 Received: (at 4823-done) by debbugs.gnu.org; 2 Jul 2011 01:48:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QcpJV-0001gi-2S for submit@debbugs.gnu.org; Fri, 01 Jul 2011 21:48:05 -0400 Received: from mail-pz0-f50.google.com ([209.85.210.50]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QcpJT-0001fu-Sm for 4823-done@emacsbugs.donarmstrong.com; Fri, 01 Jul 2011 21:48:04 -0400 Received: by pzk2 with SMTP id 2so1213624pzk.37 for <4823-done@emacsbugs.donarmstrong.com>; Fri, 01 Jul 2011 18:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=FdGLfk0l24bIKh+9PNNn0yE8YIIOwKeeDwHMDcXuG14=; b=O5ZULSA01o2qQHACaTL+ia3TXtEcxua+z28210PFPGjRe6CTQDx3MsCtP5qFyOF1kF IA67mc/X4Fr7Jt6PhrzJmEYMpYkcFlfkkKzCn6UAU7z7iWQwSd0gFA6vgZih7CS71wWe vdArxOh2CeXfDAW74y6fmgAIxUOkDGi2j17Tc= Received: by 10.143.29.13 with SMTP id g13mr1406180wfj.221.1309571278143; Fri, 01 Jul 2011 18:47:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.50.7 with HTTP; Fri, 1 Jul 2011 18:47:18 -0700 (PDT) In-Reply-To: References: From: Juanma Barranquero Date: Sat, 2 Jul 2011 03:47:18 +0200 Message-ID: Subject: Re: bug#4823: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths: To: 4823-done@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 4823-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.7 (/) > I'm closing this one No, *now* I'm closing it... =C2=A0 =C2=A0 Juanma From unknown Sat Jun 14 17:59:14 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 30 Jul 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator