From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#21454: 25.1.50; `parse-colon-path' fails with file names containing multiple consecutive "/" Date: Tue, 13 Sep 2016 17:55:30 +0900 (JST) Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1473757085 7417 195.159.176.226 (13 Sep 2016 08:58:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 13 Sep 2016 08:58:05 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: tino.calancha@gmail.com To: 21454@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 13 10:58:01 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjjXO-0000ni-BJ for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Sep 2016 10:57:54 +0200 Original-Received: from localhost ([::1]:47339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjjXM-0004pL-Gz for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Sep 2016 04:57:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjjVg-0003i6-UW for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 04:56:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjjVc-0005Oz-Vt for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 04:56:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjjVc-0005ON-S0 for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 04:56:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bjjVa-00081t-9I for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 04:56:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Sep 2016 08:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21454 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 21454-submit@debbugs.gnu.org id=B21454.147375694130839 (code B ref 21454); Tue, 13 Sep 2016 08:56:02 +0000 Original-Received: (at 21454) by debbugs.gnu.org; 13 Sep 2016 08:55:41 +0000 Original-Received: from localhost ([127.0.0.1]:58194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjjVF-00081K-7D for submit@debbugs.gnu.org; Tue, 13 Sep 2016 04:55:41 -0400 Original-Received: from mail-pf0-f196.google.com ([209.85.192.196]:35703) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjjVD-000816-3a for 21454@debbugs.gnu.org; Tue, 13 Sep 2016 04:55:39 -0400 Original-Received: by mail-pf0-f196.google.com with SMTP id z84so1002162pfi.2 for <21454@debbugs.gnu.org>; Tue, 13 Sep 2016 01:55:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:message-id:user-agent:mime-version; bh=uF7MRGIR5RuztRMrJLbNmY+IPbw08VYZYTToRfW3TNY=; b=xJ6r43Xe0chbh1XmjpeSSnU55STmTeWhucuYfh4qy+j1vh6tlem6Gg9mOdjAZGw51H GQS0zJyJx1LYCxNwcbKvYF+2RMgT6ECDH1EKllmQi4Zv4CSkGaij7eHUpcZWK0maktfj iNFl7a4nxQdtJk+Dy5TKDlRErhn65T4gnTFV58K4rS/Tbua7sakVQYPkUKu0vDWngWlt B5HLFmHB5k37jWpuU7h7Tx/OxJOscu7+P4E071e8I+yHMDS8GfxRqZAERiPCbH00uIum 1lNK8AkrY58Fkum5tXpu4/6FKVBSK81f7GgdaXzZaxIae2Bn1Q8/ju8ye1wD8FrGgi0t mWpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:message-id:user-agent :mime-version; bh=uF7MRGIR5RuztRMrJLbNmY+IPbw08VYZYTToRfW3TNY=; b=QKfWMABWGDEESoO3S1D3FBc6Q+A/257XDGVi7AZ2Ae3FbOSgU8F6qgRvn6J7rLl3Io b4S/7Qxz+bVweVmL07/ilTdHf233+fugKoH0ngT3cJRSFHQjh6v3IRQl70NN5RXQCOYC CVNCfHKQaYNSVBiVK6kf1Fn3dSRRT0Hj9fJ4i3RKA8swz8sEf+SGdn0xzf3vYeot0/95 PDrU3l/BABe7cytUWMVyL5KyQxMWpnhPurveO5gQgwtHf4Ay17m6+bw4GLwYvnXvxMvj CdKoDso6tHhb2JdyD6RA6xKQCw7zIeUKOoECgCblTeaI1dRRldUWFn0usi5nHnGpzmmf g8Zg== X-Gm-Message-State: AE9vXwPppYPTAX6j2rt7GnUnXPnW+jOZEvGt12FqZLJEh3mFVJURC0HiI2n5jnh8ddJTIA== X-Received: by 10.98.213.68 with SMTP id d65mr30723304pfg.112.1473756933321; Tue, 13 Sep 2016 01:55:33 -0700 (PDT) Original-Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id y184sm29552356pfg.94.2016.09.13.01.55.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Sep 2016 01:55:32 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:123245 Archived-At: A new patch handling multiple "/" in front of a dir as it was done before: collapse multiple "/" in front of the directory. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From c363eee16029566be565ef37bec7952fdb630bb1 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Tue, 13 Sep 2016 17:40:55 +0900 Subject: [PATCH] parse-colon-path: Handle a dir with 2 consecutive dir separator Do not truncate /foo//bar to /bar/ * lisp/files.el (parse-colon-path): Use substitute-env-vars and expand-file-name instead of substitute-in-file-name (Bug#21454). --- lisp/files.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 4bd708d..79e5abf 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -672,10 +672,17 @@ parse-colon-path a leading or trailing separator, or two adjacent separators), return nil (meaning `default-directory') as the associated list element." (when (stringp search-path) - (mapcar (lambda (f) - (if (equal "" f) nil - (substitute-in-file-name (file-name-as-directory f)))) - (split-string search-path path-separator)))) + (let ((spath (substitute-env-vars search-path))) + (mapcar (lambda (f) + (if (equal "" f) nil + (let ((dir (expand-file-name (file-name-as-directory f)))) + ;; Previous implementation used `substitute-in-file-name' + ;; which collapse multiple "/" in front. Do the same for + ;; backward compatibility. + (while (and (char-equal ?/ (aref dir 0)) + (char-equal ?/ (aref dir 1))) + (setq dir (substring dir 1))) dir))) + (split-string spath path-separator))))) (defun cd-absolute (dir) "Change current directory to given absolute file name DIR." -- 2.9.3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.21.5) of 2016-09-13 Repository revision: ead76c4603f2c4a1761ab8a7dd5cf6f56e782fb2