Subject: bug#32240: Segfault when execlp vim/nano

From: Mark H Weaver <[email-masked]>
Date: Thu, 02 Aug 2018 11:03:27 -0400

Hi,

ouzb65ty <[email-masked]> writes:

> When I call (execlp "vim") or (execlp "nano") in Guile :
> Fatal error 11: Segmentation fault[1]    31380 segmentation fault  guile test.scm

When calling the 'exec*' procedures, in both Scheme and C, you should
pass at least two arguments.  The first argument is the program to run,
and the second argument will become argv[0] in the executed program.
Normally this should be the program name again, although in some cases
it is useful to pass a different value as argv[0].

Note that in the Guile manual, the entry for 'execlp' begins by saying
that it's "Similar to 'execl', however ...", and the description of
'execl' states: "If ARG is missing, FILENAME is executed with a null
argument list, which may have system-dependent side-effects."

On my GNU/Linux system, I see this:

  scheme@(guile-user)> (execlp "ls")
  A NULL argv[0] was passed through an exec system call.
  Aborted

Based on your report, I guess that on Darwin it leads to a segfault.

In any case, you are using 'execlp' incorrectly.  It might be that we
should raise an error at the Scheme level if these procedures are called
with only one argument.

Anyway, does it work if you run (execlp "vim" "vim") instead?

      Mark