From f939cd025539791ad9af34b43af029a4f3d04f5f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 14 Apr 2018 21:55:08 +0200 Subject: [PATCH] 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 8fb61f56338..8019443c09f 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; -- 2.11.4.GIT