GNU bug report logs - #12351
24.1; parse-colon-path turns empty paths into nil

Previous Next

Package: emacs;

Reported by: Dave Abrahams <dave <at> boostpro.com>

Date: Tue, 4 Sep 2012 19:06:01 UTC

Severity: normal

Found in version 24.1

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 12351 <at> debbugs.gnu.org (full text, mbox):

From: Wolfgang Jenkner <wjenkner <at> inode.at>
To: Dave Abrahams <dave <at> boostpro.com>
Cc: 12351 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#12351: 24.1; parse-colon-path turns empty paths into nil
Date: Mon, 31 Dec 2012 02:40:21 +0100
On Sun, Dec 30 2012, Dave Abrahams wrote:

> The following function is buggy because of the original bug:
>
> (defun osx-plist-update-exec-path ()
>   "Update `exec-path' from the PATH environment variable."
>   (let ((path (getenv "PATH")))
>     (mapc (lambda (dir)
>             (add-to-list 'exec-path dir))
>           (parse-colon-path path)))
>   exec-path)
>
> I had to replace it in my local installation as follows:
>
>   (defun osx-plist-update-exec-path ()
>     "Update `exec-path' from the PATH environment variable."
>     (let ((path (delq nil (parse-colon-path (getenv "PATH")))))
>       (setq exec-path
>             (dolist (dir exec-path path)
>               (add-to-list 'path (file-name-as-directory dir) :append)))))

But the first function exhibited a bug only with an empty component in
the path.  So I'd guess that nil ought to be replaced by "." instead of
being deleted from the list.  If the second function gives the correct
result that means that exec-path already contained "." before the call.

And in any case, wouldn't the trivial patch (relative to trunk) below do
the right thing here?

Confused,

Wolfgang

=== modified file 'lisp/files.el'
--- lisp/files.el	2012-12-17 15:51:49 +0000
+++ lisp/files.el	2012-12-31 01:00:47 +0000
@@ -664,7 +664,7 @@
   (when (stringp search-path)
     (mapcar (lambda (f)
 	      (substitute-in-file-name (file-name-as-directory f)))
-	    (split-string search-path path-separator t))))
+	    (split-string search-path path-separator))))
 
 (defun cd-absolute (dir)
   "Change current directory to given absolute file name DIR."





This bug report was last modified 12 years and 201 days ago.

Previous Next


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