From: Dave Abrahams <dave@boostpro.com>
To: Wolfgang Jenkner <wjenkner@inode.at>
Cc: 12351@debbugs.gnu.org
Subject: bug#12351: 24.1; parse-colon-path turns empty paths into nil
Date: Sun, 30 Dec 2012 22:11:19 -0500 [thread overview]
Message-ID: <m2wqvy9aqw.fsf@cube.luannocracy.com> (raw)
In-Reply-To: <85fw2nq9mi.fsf@iznogoud.viz> (Wolfgang Jenkner's message of "Mon, 31 Dec 2012 02:40:21 +0100")
on Sun Dec 30 2012, Wolfgang Jenkner <wjenkner-AT-inode.at> wrote:
> 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.
No, that would be wrong. Every OS I know of treats empty elements in
"colon paths" (semicolon paths on Windows) differently from elements
that are "."
> 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."
It depends whether you think the "right thing" is the old behavior or
the documented behavior or something else.
--
Dave Abrahams
BoostPro Computing Software Development Training
http://www.boostpro.com Clang/LLVM/EDG Compilers C++ Boost
next prev parent reply other threads:[~2012-12-31 3:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-04 18:58 bug#12351: 24.1; parse-colon-path turns empty paths into nil Dave Abrahams
2012-09-16 15:57 ` Chong Yidong
2012-12-30 18:52 ` Glenn Morris
2012-12-30 19:53 ` Dave Abrahams
2012-12-30 20:22 ` Eli Zaretskii
2012-12-30 20:37 ` Dave Abrahams
2012-12-30 22:08 ` Andreas Schwab
2012-12-31 3:08 ` Dave Abrahams
2012-12-31 7:14 ` Glenn Morris
2012-12-31 12:59 ` Dave Abrahams
2012-12-31 10:07 ` Andreas Schwab
2012-12-31 1:40 ` Wolfgang Jenkner
2012-12-31 3:11 ` Dave Abrahams [this message]
2012-12-31 6:56 ` Glenn Morris
2012-12-31 7:07 ` Glenn Morris
2012-12-31 12:58 ` Dave Abrahams
2012-12-31 16:10 ` Wolfgang Jenkner
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2wqvy9aqw.fsf@cube.luannocracy.com \
--to=dave@boostpro.com \
--cc=12351@debbugs.gnu.org \
--cc=wjenkner@inode.at \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).