GNU bug report logs - #21454
25.0.50; `parse-colon-path' fails with paths containing consecutive directory separators

Previous Next

Package: emacs;

Reported by: Tino Calancha <f92capac <at> gmail.com>

Date: Thu, 10 Sep 2015 11:13:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 25.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andreas Schwab <schwab <at> suse.de>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 21454 <at> 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
On Sep 13 2016, Tino Calancha <tino.calancha <at> 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 <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




This bug report was last modified 4 years and 287 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.