From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andreas Schwab 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 11:16:28 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1473758244 10969 195.159.176.226 (13 Sep 2016 09:17:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 13 Sep 2016 09:17:24 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cc: 21454@debbugs.gnu.org To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 13 11:17:20 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 1bjjq9-00023K-T9 for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Sep 2016 11:17:18 +0200 Original-Received: from localhost ([::1]:47435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjjq8-0004IU-1G for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Sep 2016 05:17:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjjpx-0004Gb-C5 for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 05:17:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjjpu-0002lz-4q for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 05:17:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjjpu-0002lr-1A for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 05:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bjjpt-00006F-NH for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 05:17:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Sep 2016 09:17:01 +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.1473758192345 (code B ref 21454); Tue, 13 Sep 2016 09:17:01 +0000 Original-Received: (at 21454) by debbugs.gnu.org; 13 Sep 2016 09:16:32 +0000 Original-Received: from localhost ([127.0.0.1]:58198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjjpP-00005V-WE for submit@debbugs.gnu.org; Tue, 13 Sep 2016 05:16:32 -0400 Original-Received: from mx2.suse.de ([195.135.220.15]:36682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjjpN-00005M-IE for 21454@debbugs.gnu.org; Tue, 13 Sep 2016 05:16:30 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Original-Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 70A99ACBE; Tue, 13 Sep 2016 09:16:28 +0000 (UTC) X-Yow: As a FAD follower, my BEVERAGE choices are rich and fulfilling! In-Reply-To: (Tino Calancha's message of "Tue, 13 Sep 2016 17:55:30 +0900 (JST)") 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:123246 Archived-At: On Sep 13 2016, Tino Calancha wrote: > 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))) aref signals an error if dir is too short. You can also avoid the loop if you write it as (if (string-match "\\`/+" dir) (substring dir (1- (match-end 0))) dir). Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."