GNU bug report logs - #30564
call-process always fails for empty exec-path

Previous Next

Package: emacs;

Reported by: Christopher Wellons <wellons <at> nullprogram.com>

Date: Wed, 21 Feb 2018 02:08:02 UTC

Severity: minor

Tags: fixed

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30564 in the body.
You can then email your comments to 30564 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#30564; Package emacs. (Wed, 21 Feb 2018 02:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Wellons <wellons <at> nullprogram.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 21 Feb 2018 02:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Wellons <wellons <at> nullprogram.com>
To: bug-gnu-emacs <at> gnu.org
Subject: call-process always fails for empty exec-path
Date: Tue, 20 Feb 2018 21:07:36 -0500
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30564; Package emacs. (Sat, 14 Apr 2018 19:57:01 GMT) Full text and rfc822 format available.

Message #8 received at 30564 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Christopher Wellons <wellons <at> nullprogram.com>
Cc: 30564 <at> debbugs.gnu.org
Subject: Re: bug#30564: call-process always fails for empty exec-path
Date: Sat, 14 Apr 2018 21:56:38 +0200
Christopher Wellons <wellons <at> 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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 14 Apr 2018 19:57:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 30564 <at> debbugs.gnu.org and Christopher Wellons <wellons <at> nullprogram.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 14 Apr 2018 19:57:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 13 May 2018 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.