From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs 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 Message-ID: <87tweth2er.fsf@users.sourceforge.net> References: <5571CF77.5000902@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1470790343 3877 195.159.176.226 (10 Aug 2016 00:52:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 10 Aug 2016 00:52:23 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 20744@debbugs.gnu.org To: Da Zhang Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 10 02:52:20 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXHkp-0000r0-7B for geb-bug-gnu-emacs@m.gmane.org; Wed, 10 Aug 2016 02:52:19 +0200 Original-Received: from localhost ([::1]:38743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXHkl-0004S2-TO for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Aug 2016 20:52:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXHkc-0004Qy-F4 for bug-gnu-emacs@gnu.org; Tue, 09 Aug 2016 20:52:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXHkY-0002hV-9k for bug-gnu-emacs@gnu.org; Tue, 09 Aug 2016 20:52:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36171) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXHkY-0002h4-6o for bug-gnu-emacs@gnu.org; Tue, 09 Aug 2016 20:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bXHkX-00089r-QK for bug-gnu-emacs@gnu.org; Tue, 09 Aug 2016 20:52:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Aug 2016 00:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20744 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20744-submit@debbugs.gnu.org id=B20744.147079028631315 (code B ref 20744); Wed, 10 Aug 2016 00:52:01 +0000 Original-Received: (at 20744) by debbugs.gnu.org; 10 Aug 2016 00:51:26 +0000 Original-Received: from localhost ([127.0.0.1]:33468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXHjy-00088v-6X for submit@debbugs.gnu.org; Tue, 09 Aug 2016 20:51:26 -0400 Original-Received: from mail-io0-f175.google.com ([209.85.223.175]:33349) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXHjw-00088Z-N8; Tue, 09 Aug 2016 20:51:25 -0400 Original-Received: by mail-io0-f175.google.com with SMTP id 38so27786450iol.0; Tue, 09 Aug 2016 17:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=J/HSXcktzP7lkW3fgYbWinO4Zv80YrAgDe2wyw4Uo8k=; b=amE/l5I0AcGm8N5mc+ejyhMdN4eXU2UXKidSQxxIF4wUBB0S4yzCpXoHnRuCE61RG3 cJOMw9kDX24qzvQ175ymytajDTFOrPm4eOJFzZS9+3+lxg+2VNbvWiugPXbTxE9YDb8M HIzOHhfhJavF0aXzV8Oq+3zrnqgS68Zc+kjwiYVcltsLn/27rbY0QgBhziMKMKTV+FTT 7R6/nnFyFi1WeX5zrV14anQVhNXWT554gAaGRfZ1V4u5D8Hwq+OpB0iyJgVBrYbRM9QL g3WE4kQ+00/AZCuZ72EKbPeNu+fpGXFFY/+MXsw4eIo1EMZueZ0c0tqueJakgWqWMOks VN3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=J/HSXcktzP7lkW3fgYbWinO4Zv80YrAgDe2wyw4Uo8k=; b=Hq7QzAoQEgWQflhWHeONvYnd0utNeGvJVseS0nL5Ou0sRDEedV/iW30NAwOJ/MNSrj 3kE3oFWLoktL+ehpcqLtMEf50XtMJl8AwoGYuFvxPB2s2GeOAk9wevXnEaO4GJKep+j5 /YymSZ5arj+OpRJUR7IRXEdJ1HtHnkBtWmN3gAWIlK+b6zmrhmxVplg0fx0pisd1AHiE 5YDoPkGRpV2WZ2cN7TVUYQVvoHox77lBRaQLy1GWhXFpkJhmWptSDMoNN0CgxUqOo440 jmaIVhWgVRZyUbaCEKjdLH1tW0RGO/z/YC96I5QK+iuGxMPUmZpiBvv1WCpsktM+4jwy qNFQ== X-Gm-Message-State: AEkooutLXtZbc3VOij3fkDY6g6zwS6bp4Suh5eNUMCykoolFvsLwLNH8iLIMIKH+8mMv0g== X-Received: by 10.107.140.205 with SMTP id o196mr2367565iod.42.1470790279028; Tue, 09 Aug 2016 17:51:19 -0700 (PDT) Original-Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id x13sm2856205ite.1.2016.08.09.17.51.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2016 17:51:18 -0700 (PDT) In-Reply-To: <5571CF77.5000902@gmail.com> (Da Zhang's message of "Fri, 05 Jun 2015 12:33:59 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122024 Archived-At: retitle 20744 python.el tries to undo shell quoting with split-string-and-unquote tags 20744 confirmed found 20744 25.1 quit Da Zhang writes: > From: Da Zhang > 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).