Subject: Re: bug#25025: python-shell-calculate-command is wrong

From: [email-masked]
Date: Fri, 02 Dec 2016 10:07:57 -0500

Eli Zaretskii <[email-masked]> writes:

>> From: Noam Postavsky <[email-masked]>
>> Date: Fri, 2 Dec 2016 09:16:04 -0500
>> Cc: [email-masked], Clément Pit--Claudel <[email-masked]>
>> 
>> On Fri, Dec 2, 2016 at 2:35 AM, Eli Zaretskii <[email-masked]> wrote:
>> >> --- a/lisp/progmodes/python.el
>> >> +++ b/lisp/progmodes/python.el
>> >> @@ -2379,7 +2379,7 @@ python-shell-internal-get-process-name
>> >>  (defun python-shell-calculate-command ()
>> >>    "Calculate the string used to execute the inferior Python process."
>> >>    (format "%s %s"
>> >> -          (shell-quote-argument python-shell-interpreter)
>> >> +          (combine-and-quote-strings (list python-shell-interpreter))
>> >>            python-shell-interpreter-args))
>> >
>> > Isn't combine-and-quote-strings wrong for quoting shell commands?
>> > AFAIR, it doesn't DTRT with some special characters that can appear in
>> > file names on Unix.  Am I mistaken?
>> 
>> It's not a shell command though, hence this bug.
>
> No, but the code in question generates a shell command, from the file
> name of the interpreter and its arguments.  Right?

Okay, let me rephrase.  `python-shell-calculate-command' currently
generates a shell command, but none of its callers treat the result as a
shell command (they don't pass it to a shell, they parse it with
`split-string-and-unquote').  Therefore, the easiest fix is to change
`python-shell-calculate-command' to no longer generate a shell command.

The other possiblity is to change the callers to treat
`python-shell-calculate-command's result as a shell command, but that
looks more difficult (though it may be the better solution overall).