[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master f939cd0 1/2: Make call-process work if exec-path is
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master f939cd0 1/2: Make call-process work if exec-path is nil |
Date: |
Sat, 14 Apr 2018 15:56:10 -0400 (EDT) |
branch: master
commit f939cd025539791ad9af34b43af029a4f3d04f5f
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Make call-process work if exec-path is nil
* src/lread.c (openp): If exec-path is nil, no files would be
found to execute (bug#30564).
Test cases:
(let ((exec-path ()))
(call-process "/bin/ls" nil (current-buffer)))
This would previously fail, but now works.
(let ((exec-path '("/bin/")))
(call-process "ls" nil (current-buffer)))
This worked, and still works.
---
src/lread.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/lread.c b/src/lread.c
index 8fb61f5..8019443 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1587,11 +1587,14 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object
suffixes,
absolute = complete_filename_p (str);
- for (; CONSP (path); path = XCDR (path))
+ do
{
ptrdiff_t baselen, prefixlen;
- filename = Fexpand_file_name (str, XCAR (path));
+ if (NILP (path))
+ filename = str;
+ else
+ filename = Fexpand_file_name (str, XCAR (path));
if (!complete_filename_p (filename))
/* If there are non-absolute elts in PATH (eg "."). */
/* Of course, this could conceivably lose if luser sets
@@ -1768,7 +1771,8 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object
suffixes,
}
if (absolute)
break;
- }
+ path = XCDR (path);
+ } while (CONSP (path));
SAFE_FREE ();
errno = last_errno;