From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands. Date: Fri, 18 Dec 2020 18:23:39 +0100 Message-ID: <87tusj58pw.fsf@gmx.de> References: <20201218123338.4927.85373@vcs0.savannah.gnu.org> <20201218123339.A90E820B72@vcs0.savannah.gnu.org> <87czz787dk.fsf@gmx.de> <87y2hv5ch6.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3983"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 18 18:25:33 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kqJVV-0000ws-0T for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Dec 2020 18:25:33 +0100 Original-Received: from localhost ([::1]:33630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqJVT-0006xi-17 for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Dec 2020 12:25:31 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqJTs-00063R-Jc for emacs-devel@gnu.org; Fri, 18 Dec 2020 12:23:52 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]:37157) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqJTl-0003T0-42 for emacs-devel@gnu.org; Fri, 18 Dec 2020 12:23:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1608312220; bh=n2dNkSR40WCqtdqZvXUoYisK/gtfHZg8+iCxmfFAhm8=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=gw8+F3u33X+Zvw1/Uoqi044CLNg5AFNI8bXF0hODrD/WpvdeB27Np1R5HdeDsJ4g5 5aJiZjRsku6+3O4cw7Fgu5W2fEuH1wASitWnAGshWFFbbf20OqOBzKC9i6ePkH4rJ6 bhWuPjOFdL2mPDHv44PWrQmwFL19Uc57c0S9uvec= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([212.86.38.187]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M4b1y-1kplFK2SqE-001iSF; Fri, 18 Dec 2020 18:23:40 +0100 In-Reply-To: (Stefan Monnier's message of "Fri, 18 Dec 2020 11:28:28 -0500") X-Provags-ID: V03:K1:xydYSZGLycRPXe4zUvisyeKfsXggMkSaFb8w+7jOn6MZ1/KiSFx KEWhkRLr6rjOXVKBXMkMvmzXy+NzYjEcrofvc0P3nJmw4Z2C4bxn0kg2mWJYu+zmLdFEOWr nRFR41Tom4P+KNW9PyTpFGAbTYwe+RM7HT90wcU1UfNkdYBrS+6SC83GQK8aTkJ9E865yUz Ljvtp9NssSnga/ktn7mTg== X-UI-Out-Filterresults: notjunk:1;V03:K0:lmUqZoeoOuE=:EblmgAVxqhts88e/Ghj6or FBptxvmYkXM2AuHWPJT78YOB9Pgo3UoUwOxlWC12thLSlJX8If7GSj7Lhsu2njTyOdIaIZZ3y F/JfKtznFhDQmSdP99WqToq/6FShrF3Yyg8/FBOdW0Gc919+XKOjyWimQBczuF9VO7/t6XFxu Ukx/CiwQgotjPT4EEjxplb9NsT+EXjtayYXy+238noabSOrQ72q0gASo8ux9ah+jtWlzrx4/L F1aKN2f5IK20y+FLpL7C0zmnIKzLrRiEzi2XGde/XWmLZ9r2xUMFjhvNjwDquZ9fLgNj/5KYA Iogsw3Bv/do72IBhwGk+mnV1mdqFCqEH3vX7TQ2PFOIegGGw0Ja4TXST5cOw04PGnJRcfbGYY +T/8FRG0bwAwJB4j2uPIBGTKw84UfguEYyvGHPj58UcVMVlNXAeQtojqXmXqHjqZmn5b2/N2y 6otJFh8KbU5eEBiNzBPRgUlGxsYsLiotBkyX4rl6A+tBihap1i55Qlfl3vHEgalWzgP77j4SM eS4y5qjF1ARJloSIx2F7D7GfepVRDZhbHNJHnYmy6dh+S8Av7+CypomlQOArPcTUOVM2wmR9v bvtZYqkgqtfcNZTqMsTQlIEVxX/TND9E3DVagCPwM8X8oCg80fj6dXTb3p3/rsmyLFqru0/aI 3Win8XA9C258baoODtLmK+Dlt/d0qoWQ8vACJvyMUPMBl/rIxK73Ug43ek/88wetOcO7XCKnu nSScUICi7AFDWTpXzAmfxzo/ONuBmOOaAPbRFV2hY+oWFL8Yenbft/p2s1ggb+FLyCa71xV5 Received-SPF: pass client-ip=212.227.17.20; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:261210 Archived-At: Stefan Monnier writes: >>> BTW, what would go wrong if you did >>> (setq command (mapcar #'tramp-shell-quote-argument command))? >> >> Tried that, didn't work. Imagine, you call "M-x rgrep" on a remote >> machine. This ends up in a make-process call with :command > [...] >> As you see, three arguments "/bin/sh" "-c" and "find ...". If I do your >> proposal, Tramp would send finally > > I don't understand: your code leaves "sh" and "-c" and passes the third > through `tramp-shell-quote-argument`, but that should give the exact > same result as passing all three through `tramp-shell-quote-argument` > since "sh" and "-c" are both left unchanged by `tramp-shell-quote-argument`. > > What am I missing? The example I gave you was simplified. If you look into tramp-handle-make-process, you'll see a more complex machinery. And yes, I've tried several variants of quoting before I found this working solution. But I don't believe it shall be solved in this function. Because it is about quoting of a shell command, it is likely that it would be better fixed in start-file-process-shell-command. I would prefer (defun start-file-process-shell-command (name buffer &rest args) "..." (with-connection-local-variables (start-file-process name buffer shell-file-name shell-command-switch (shell-quote-argument (mapconcat 'identity args " "))))) However, shell-quote-argument quotes wrt the local shell. A shell on the remote host might quote differently. Maybe we make start-file-process-shell-command a magic function? or shell-quote-argument? Don't know. I'll experiment with this next days. People will be in the Xmas break, so there's time. > Stefan Best regards, Michael.