* bug#30564: call-process always fails for empty exec-path
@ 2018-02-21 2:07 Christopher Wellons
2018-04-14 19:56 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Christopher Wellons @ 2018-02-21 2:07 UTC (permalink / raw
To: 30564
The call-process function incorrectly fails for valid absolute paths
when exec-path is nil:
(let ((exec-path ()))
(call-process "/bin/ls"))
;; error: (file-error "Searching for program"
;; "No such file or directory" "/bin/ls")
Adding a single element to exec-path fixes the problem, even if that
element is nonsense:
(let ((exec-path '(t)))
(call-process "/bin/ls"))
;; => 0
The bug is in the for loop in openp() (lread.c). The only successful
returns are found inside the loop. An empty list results in no loop
iterations, which means an absolute path has no chance to return
successfully.
This bug dates back at least as far as Emacs 24.3.
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#30564: call-process always fails for empty exec-path
2018-02-21 2:07 bug#30564: call-process always fails for empty exec-path Christopher Wellons
@ 2018-04-14 19:56 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-14 19:56 UTC (permalink / raw
To: Christopher Wellons; +Cc: 30564
Christopher Wellons <wellons@nullprogram.com> writes:
> The call-process function incorrectly fails for valid absolute paths
> when exec-path is nil:
>
> (let ((exec-path ()))
> (call-process "/bin/ls"))
> ;; error: (file-error "Searching for program"
> ;; "No such file or directory" "/bin/ls")
>
> Adding a single element to exec-path fixes the problem, even if that
> element is nonsense:
>
> (let ((exec-path '(t)))
> (call-process "/bin/ls"))
> ;; => 0
>
> The bug is in the for loop in openp() (lread.c). The only successful
> returns are found inside the loop. An empty list results in no loop
> iterations, which means an absolute path has no chance to return
> successfully.
I've now fixed this by transforming the for loop into a do/while loop.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-14 19:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-21 2:07 bug#30564: call-process always fails for empty exec-path Christopher Wellons
2018-04-14 19:56 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.