]> git.eshelyaron.com Git - emacs.git/commitdiff
Make call-process work if exec-path is nil
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 14 Apr 2018 19:55:08 +0000 (21:55 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 14 Apr 2018 19:55:08 +0000 (21:55 +0200)
* 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

index 8fb61f56338aad751e794a49b0f5b4a80450b0d0..8019443c09f0543c57800450afdd05ebf5dd2281 100644 (file)
@@ -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;