From: npostavs@users.sourceforge.net
To: Da Zhang <zhangda82@gmail.com>
Cc: 20744@debbugs.gnu.org
Subject: bug#20744: shell-quote-argument in Emacs 24.5 and Emacs 25 on Windows cannot figure out path correctly
Date: Tue, 09 Aug 2016 20:51:24 -0400 [thread overview]
Message-ID: <87tweth2er.fsf@users.sourceforge.net> (raw)
In-Reply-To: <5571CF77.5000902@gmail.com> (Da Zhang's message of "Fri, 05 Jun 2015 12:33:59 -0400")
retitle 20744 python.el tries to undo shell quoting with split-string-and-unquote
tags 20744 confirmed
found 20744 25.1
quit
Da Zhang <zhangda82@gmail.com> writes:
> From: Da Zhang <zhangda82@gmail.com>
> To: bug-gnu-emacs@gnu.org
> Subject: 24.5; shell-quote-argument in Emacs 24.5 and Emacs 25 on Windows cannot figure out path correctly
> --text follows this line--
>
> Dear Emacs developers/maintainers,
>
> I am writing this email to report an issue that has been bothering me
> for a while.
>
> I use python mode (python.el) for some python programming. When I invoke
> the command python-shell-send-buffer, my Emacs always reports "Searching
> for program: no such file or directory,
> c\:/Anaconda3/Scripts/ipython.exe".
>
[...]
>
> The function call
> (shell-quote-argument (executable-find python-shell-interpreter))
> changed the path of my python interpreter from
> "c:/Anaconda3/Scripts/ipython.exe"
> to
> "c\\:/Anaconda3/Scripts/ipython.exe".
>
> I worked around this problem by replacing the function call
> (shell-quote-argument (executable-find python-shell-interpreter))
> with
> (executable-find python-shell-interpreter) ;; edited by DZ on
> 2015/06/05: (shell-quote-argument) caused the problem of
> "c\\:/Anaconda3/Scripts/ipython.exe"
>
> To further analyze the problem, I found the function
> shell-quote-argument defined in subr.el does not deal with the case when
> bash from cygwin is used.
>
[...]
Actually, bash, regardless of being on cygwin or not, should have no
problem with an escaped ":". The actual problem here is that python.el
is using shell-quote-argument but then not using a shell. The result of
python-shell-calculate-command (formerly known as
python-shell-parse-command) gets passed to python-shell-make-comint as
the CMD argument:
(defun python-shell-make-comint (cmd proc-name &optional show internal)
[...]
(let* ((cmdlist (split-string-and-unquote cmd))
(buffer (apply #'make-comint-in-buffer proc-name proc-buffer-name
interpreter nil args))
make-comint-in-buffer uses start-file-process, i.e., no shell is called.
So python.el is trying to undo shell-quote-argument with
split-string-and-unquote, this is the bug.
To see this on any system, compare
C-u M-x run-python RET 'python' -i
this fails, while
C-u M-x run-python RET "python" -i
this succeeds (assuming you have python in exec-path).
prev parent reply other threads:[~2016-08-10 0:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-05 16:33 bug#20744: shell-quote-argument in Emacs 24.5 and Emacs 25 on Windows cannot figure out path correctly Da Zhang
2015-06-05 20:13 ` Eli Zaretskii
2015-06-05 20:50 ` Da Zhang
2015-06-05 21:05 ` Da Zhang
2015-06-07 18:01 ` Glenn Morris
2015-06-07 19:11 ` Eli Zaretskii
2015-06-08 0:07 ` Glenn Morris
2015-06-08 0:24 ` Glenn Morris
2015-06-08 0:47 ` Glenn Morris
2015-06-08 2:43 ` Eli Zaretskii
2015-06-08 7:43 ` Michael Albinus
2015-06-08 14:31 ` Eli Zaretskii
2015-06-08 15:14 ` Michael Albinus
2015-06-08 16:22 ` Eli Zaretskii
2015-06-08 16:34 ` Michael Albinus
2015-06-08 14:03 ` Stefan Monnier
2016-08-10 0:51 ` npostavs [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tweth2er.fsf@users.sourceforge.net \
--to=npostavs@users.sourceforge.net \
--cc=20744@debbugs.gnu.org \
--cc=zhangda82@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).