From: Andreas Schwab <schwab@suse.de>
To: Tino Calancha <tino.calancha@gmail.com>
Cc: 21454@debbugs.gnu.org
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 [thread overview]
Message-ID: <mvmeg4ocg7n.fsf@hawking.suse.de> (raw)
In-Reply-To: <alpine.DEB.2.20.1609131753150.5025@calancha-pc> (Tino Calancha's message of "Tue, 13 Sep 2016 17:55:30 +0900 (JST)")
On Sep 13 2016, Tino Calancha <tino.calancha@gmail.com> 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."
next prev parent reply other threads:[~2016-09-13 9:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-10 11:15 bug#21454: 25.0.50; `parse-colon-path' fails with paths containing consecutive directory separators Tino Calancha
2015-09-10 12:48 ` bug#21454: (no subject) Tino Calancha
2016-04-24 17:26 ` bug#21454: 25.0.93; `parse-colon-path' over dirs with 2 consecutive dir sep Tino Calancha
2016-09-13 8:55 ` bug#21454: 25.1.50; `parse-colon-path' fails with file names containing multiple consecutive "/" Tino Calancha
2016-09-13 9:16 ` Andreas Schwab [this message]
2016-09-13 9:40 ` Tino Calancha
2017-08-31 1:09 ` npostavs
2019-06-25 15:28 ` Lars Ingebrigtsen
2019-06-25 16:29 ` Andreas Schwab
2020-08-12 12:54 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mvmeg4ocg7n.fsf@hawking.suse.de \
--to=schwab@suse.de \
--cc=21454@debbugs.gnu.org \
--cc=tino.calancha@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.