From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Whitton Newsgroups: gmane.emacs.bugs Subject: bug#54603: 29.0.50; [PATCH] Eshell's external pipe module interferes with other argument parsing hooks Date: Thu, 31 Mar 2022 11:26:26 -0700 Message-ID: <871qyij7vx.fsf@melete.silentflame.com> References: <70677cd2-f741-16d1-b38f-c39b507cc95e@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7165"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Emacs/29.0.50 (x86_64-pc-linux-gnu) To: Jim Porter , 54603@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 31 20:42:57 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1nZzl1-0001dA-CP for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Mar 2022 20:42:57 +0200 Original-Received: from localhost ([::1]:45510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZzl0-00039e-EL for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Mar 2022 14:42:54 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZzVe-0000Xz-2i for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 14:27:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45865) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nZzVd-0003t7-PJ for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 14:27:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nZzVd-0005o9-Lr for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 14:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Mar 2022 18:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54603 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 54603-submit@debbugs.gnu.org id=B54603.164875119522284 (code B ref 54603); Thu, 31 Mar 2022 18:27:01 +0000 Original-Received: (at 54603) by debbugs.gnu.org; 31 Mar 2022 18:26:35 +0000 Original-Received: from localhost ([127.0.0.1]:39762 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZzVC-0005nM-UT for submit@debbugs.gnu.org; Thu, 31 Mar 2022 14:26:35 -0400 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:33403) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZzVB-0005n4-8D for 54603@debbugs.gnu.org; Thu, 31 Mar 2022 14:26:34 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id D33065C00C9; Thu, 31 Mar 2022 14:26:27 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 31 Mar 2022 14:26:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; bh=m73PLjqte/yXyX/6xiqfKd9VrXg2U+Z41xCkW/ USjjM=; b=eHqoIZ9fVFEaqK2pAqJqxrXSleulScG7x9CjZGp1+4XU6NwNmjr/7j N1TEuP311rV4c4ISCVZOtQEIM9y+8ZhHwYXyxjNc8xlyqL6xiY6L0lhNCoq76gVl hLxPgAbmvY6mJFHYDRa+n1TDNaSV/b182MmiEwOPAtLyUgpDHr5eir+/o3Lva1Uj igJGKxo73a4c9On9ePPhTxcb+OqGyKTlsKnlasHLWG9l/ZJvJLeCldvs7vn9yVa0 BLxs/Y9Ute9EiCvUkG3CHyACbb1qPMKPFlKz9mwRRBuPQT9n94Un2NDmLXcsCu9X 5+SeJc9Pr73DMcH8BUC3isoZrQGTMKyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=m73PLjqte/yXyX/6x iqfKd9VrXg2U+Z41xCkW/USjjM=; b=buYx7XUQVUrx7aMhrMmotRgPsos9Dp9fE mjHoSAXkzEF3tjL+5vLQJ64TT8ntI43r4jdznai033GgplLIF6a70/XWYAcrOsXf z8tTNB7T1OS5M/Jt246e+/thAIw4gevjeSIAOGqavtT/+fP2SsfKRfllGrI5s4W5 bGW3/58hikchLZrEsaP333qz0HvrtYxbC1r03plgEhPtDrDrCJqsa5Q6iVUVvvp/ tgjzNSyxg6//P+8a/lG1gx8PjROYVzxlCR20gYWyb+tEM9V8x4llKC0Ms0fcy1Yd 0APfoxUm0Pl+jfJvjYA7eTS4nWST7a+PiQJHeEY3TSasoYNOEVf1w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudeigedguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufgjfhgffffkgggtsehttd dttddtredtnecuhfhrohhmpefuvggrnhcuhghhihhtthhonhcuoehsphifhhhithhtohhn sehsphifhhhithhtohhnrdhnrghmvgeqnecuggftrfgrthhtvghrnhepleeggefgvdeije dvhfdugfegtefgkeekueeileejjeehudeggeefteeghfeuffeknecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhpfihhihhtthhonhesshhpfi hhihhtthhonhdrnhgrmhgv X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 31 Mar 2022 14:26:27 -0400 (EDT) Original-Received: by melete.silentflame.com (Postfix, from userid 1000) id C303D7E0CA3; Thu, 31 Mar 2022 11:26:26 -0700 (MST) In-Reply-To: <70677cd2-f741-16d1-b38f-c39b507cc95e@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:229175 Archived-At: Hello Jim, On Sun 27 Mar 2022 at 07:21PM -07, Jim Porter wrote: > The attached patch resolves the issue for me, but I'm not sure if it's > the best strategy. Thank you for looking into this. I think however that the bug is not in the em-extpipe.el, and so your patch is probably not the best fix. The call to `eshell-parse-lisp-argument' is meant to handle precisely your case. It isn't doing atm, and I think it might actually be a bug over in that function. To see this, with point on the first nonblank char of each of these lines, do 'M-: (eshell-parse-lisp-argument) RET': #'foo 'foo In the first case it successfully parses it and skips point forward, but in the latter case it does not. But I think it should, right? > If possible, I think it would be better for > `eshell-parse-external-pipeline' to solely focus on finding the > external pipe operators ("*|", "*<", and "*>")[1] and then for > `eshell-rewrite-external-pipeline' to prepare the command string to > pass to sh. This would also have the advantage[2] of making it > possible to support a richer set of Eshell features with external > pipes, such as the following: > > ~ $ echo $(message "[%s]" "hi") *| cat > zsh:1: command not found: message > > (If you remove the "*", this outputs "[hi]", and it should be > technically possible to make this work with external pipes too, provided > it executes the Lisp code before generating the command string for sh.) In this case I would want the whole '$(message ..' construction to go to the external shell. Although extpipe supports some combinations of piping Eshell in and out of the external shell, fundamentally it's more about making it easier to bypass Eshell features than to make complex usage of them. It's also simpler to understand as a user. If you do want more involved combinations of Eshell and external shell commands, you can always do the 'sh -c' wrapping yourself. -- Sean Whitton