Subject: bug#16005: inferior-lisp and filenames with spaces

From: Eli Zaretskii <[email-masked]>
Date: Thu, 15 Jul 2021 09:58:56 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Date: Thu, 15 Jul 2021 07:33:33 +0200
> Cc: [email-masked]
> 
> Steven Litvintchouk <[email-masked]> writes:
> 
> > Trying to run an inferior lisp program on Windows 7,
> > with the value of inferior-lisp-program set to 
> > "D:/More Program Files (x86)/clisp-2.49/clisp.exe",
> >
> > caused an error with error message:
> > "Spawning child process: invalid argument"
> >
> > The reason is that the function inferior-lisp (defined in inf-lisp.el)
> > calls the function split-string, whose arg SEPARATORS defaults to "[ \f\t\n\r\v]+".
> 
> This problem is still present in Emacs 28:
> 
>   (interactive (list (if current-prefix-arg
> 			 (read-string "Run lisp: " inferior-lisp-program)
> 		       inferior-lisp-program)))
>   (if (not (comint-check-proc "*inferior-lisp*"))
>       (let ((cmdlist (split-string cmd)))
> 	(set-buffer (apply (function make-comint)
> 			   "inferior-lisp" (car cmdlist) nil (cdr cmdlist)))
> 	(inferior-lisp-mode)))
> 
> The only way this could work is that if we either split the prompt into
> two parts (one for the command and one for the options), or that we
> require that the user quotes the spaces, and then use a splitting
> function that's aware of that.  So the user would have to type
> 
> "D:/More Program Files (x86)/clisp-2.49/clisp.exe" -some -option
> 
> or the like.

If we prompt the users for a shell command, we should expect the users
to quote it as they would when they type at the shell's prompt.  is
this prompt for the complete shell command, or is it only for the name
of the program's executable file?  If the latter, we should run the
result through shell-quote-argument before using it; if the former,
the user should do the quoting, and there's no bug in Emacs.