From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#25025: python-shell-calculate-command is wrong Date: Sat, 26 Nov 2016 19:50:40 -0500 Message-ID: References: <83polk3qow.fsf@gnu.org> <83inra13r3.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1480207875 26110 195.159.176.226 (27 Nov 2016 00:51:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 27 Nov 2016 00:51:15 +0000 (UTC) Cc: 25025@debbugs.gnu.org, =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 27 01:51:11 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 1cAngS-0005Ix-VR for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Nov 2016 01:51:09 +0100 Original-Received: from localhost ([::1]:52238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cAngU-00051V-Us for geb-bug-gnu-emacs@m.gmane.org; Sat, 26 Nov 2016 19:51:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cAngP-00051P-Dj for bug-gnu-emacs@gnu.org; Sat, 26 Nov 2016 19:51:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cAngM-00075I-8X for bug-gnu-emacs@gnu.org; Sat, 26 Nov 2016 19:51:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55607) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cAngM-00075E-4y for bug-gnu-emacs@gnu.org; Sat, 26 Nov 2016 19:51:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cAngL-0008Pu-Rw for bug-gnu-emacs@gnu.org; Sat, 26 Nov 2016 19:51:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Nov 2016 00:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25025 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 25025-submit@debbugs.gnu.org id=B25025.148020784832307 (code B ref 25025); Sun, 27 Nov 2016 00:51:01 +0000 Original-Received: (at 25025) by debbugs.gnu.org; 27 Nov 2016 00:50:48 +0000 Original-Received: from localhost ([127.0.0.1]:42773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cAng8-0008Oz-Ko for submit@debbugs.gnu.org; Sat, 26 Nov 2016 19:50:48 -0500 Original-Received: from mail-oi0-f50.google.com ([209.85.218.50]:36010) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cAng6-0008OW-Hq for 25025@debbugs.gnu.org; Sat, 26 Nov 2016 19:50:47 -0500 Original-Received: by mail-oi0-f50.google.com with SMTP id v84so115533107oie.3 for <25025@debbugs.gnu.org>; Sat, 26 Nov 2016 16:50:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=H4b76pzBB7J8Ucx9ebiZLBvaBNDfOnn/OMgX5RwMiVM=; b=MYHdX+5TpUDRZRODB8OVfcRJMRMYFk/hOp18zZI6Ioh9XPunBeBU1mMaBPoOIUP90I HtJUyjGoxS5JSY0Jd0BR3nJ6nZbJg8U+iWqTDEeEcMRc2tX7HWsQ5DyxqWaCgRNE4j97 uxBgSDKxED1sIM5TNzDoumNo4QFpuDu4SOXZMIRecO4XvpOn82uSpUpcp3uND7CNu32l 5MHO9VZaSN5Xcsc8A+RzOfzLqNcUBaYXRuaMYdzlpbLvxWzmNbK0t9pWjp1tgCdBDLbY rM+w2nSR/v15xwKqcFhW7Cu2rhXpJkCxO8xdcqI/HN83oaKkZv0rRV7hTQh3XBDdg6/m ANTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=H4b76pzBB7J8Ucx9ebiZLBvaBNDfOnn/OMgX5RwMiVM=; b=Hwg6ngvCj2nTxuBpb8mpZVuZnkTMuwVIdUw7tfamGflk4sxdtMqmE+Bakk7sSlCB8v rachlzotmyRzIAyJWIdDwOlVOvgUj9yCBE87tsUiFnhh0dFSr/e6Ef8pZtwBD2UfBsIK +oJwBdWhxhBtOdsF/8oWGWqXMqfIeWwQkJgf5r6mBaAaeVeGUD/u/oB0/kyzPNSMAcdz DEa/EIF2r9CvC/HNHNQY3wj9AX2YDLFO3fTnSmmiseThtwvHWo+CVdN5RurQO5/fUmnD TgCdy1zoWeVc7nulgXIek3Uig9yOo46t5XqE7R+rFrvcEwWg9tmB1Dl3olvBq6edmxdT MF2Q== X-Gm-Message-State: AKaTC00Y6OQlQAI2WQW82V3Ih9teVdP/GrnofDjlb/UQwaBwNrzdc0o9ihNUtQ2y4Bll00t9wMu057P3JWKa7w== X-Received: by 10.157.54.245 with SMTP id s50mr8304136otd.181.1480207840904; Sat, 26 Nov 2016 16:50:40 -0800 (PST) Original-Received: by 10.157.4.67 with HTTP; Sat, 26 Nov 2016 16:50:40 -0800 (PST) In-Reply-To: <83inra13r3.fsf@gnu.org> X-Google-Sender-Auth: 1FeH5FhuPOkAZaAWD4yWqtZCcTE 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:126141 Archived-At: On Sat, Nov 26, 2016 at 1:43 PM, Eli Zaretskii wrote: >> From: Noam Postavsky >> Date: Fri, 25 Nov 2016 09:59:43 -0500 >> Cc: Cl=C3=A9ment Pit--Claudel , >> 25025@debbugs.gnu.org >> >> >> > The python shell name is not passed to any underlying shell. >> >> > It is used to create a process, so it must not be quoted in anyway. >> >> >> >> Are you sure? Looking at the code, I see this: >> >> >> >> (python-shell-make-comint >> >> (or cmd (python-shell-calculate-command)) =E2=80=A6) >> >> >> >> And python-shell-make-comint does this: >> >> >> >> (split-string-and-unquote cmd) >> >> >> >> (ok, this is weird). But still, if the command is "C:\Program Files\= Python\python.exe", then we *do* need the shell quoting, right? >> > >> > The quoting needs to be done only where a shell command is created >> > that is about to be passed to a shell. I believe in this case the >> > quoting is done too early. >> > >> >> I think the whole command should be quoted with >> combine-and-quote-strings to balance the call to >> split-string-and-unquote. > > Why not remove both of those calls? Do you understand why they are > needed in that case? Well, CMD can also come from user input, so we would need some way for the user to specify a list of arguments. Currently that can work by entering a string that would be split by split-string-and-unquote. It might be more intuitive to actually use a shell and then the user would enter a shell command (though inserting a shell into things might bring more complications).