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 14:55:41 -0700 Message-ID: <87bkxliy76.fsf@melete.silentflame.com> References: <70677cd2-f741-16d1-b38f-c39b507cc95e@gmail.com> <871qyij7vx.fsf@melete.silentflame.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="24055"; 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 23:56:18 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 1na2m7-0005zb-Qf for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Mar 2022 23:56:18 +0200 Original-Received: from localhost ([::1]:59032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1na2m6-0005W1-JA for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Mar 2022 17:56:14 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1na2lt-0005US-TL for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 17:56:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46135) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1na2lt-0005eE-KL for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 17:56:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1na2lt-0002rr-K8 for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 17:56: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 21:56: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.164876375011004 (code B ref 54603); Thu, 31 Mar 2022 21:56:01 +0000 Original-Received: (at 54603) by debbugs.gnu.org; 31 Mar 2022 21:55:50 +0000 Original-Received: from localhost ([127.0.0.1]:40032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1na2li-0002rQ-1B for submit@debbugs.gnu.org; Thu, 31 Mar 2022 17:55:50 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:35769) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1na2lg-0002r9-MT for 54603@debbugs.gnu.org; Thu, 31 Mar 2022 17:55:49 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 411AB5C0237; Thu, 31 Mar 2022 17:55:43 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 31 Mar 2022 17:55:43 -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=42LG7lnhXM4nQdaltunl/xuWUkND2BBE2vjPIJ Spz2U=; b=qKKAYsgWlsyDLPqExGgQTNjHy1WS24Gk2vqFy2sOsb13igPMPs6qFj QjlvCzxQst4cfUjgKzz34k40s378NJuvOU9RkgV5crWyQ9j3+0epE2ms6PbeXoJ8 09GEohZPzS5+JVRtD4FxREKDiKOyEbLgX1cPx6QnfT11ckxDVrpwrrWemWouIsgp HovrA3t4BWgn8OyggS7lpBRmIYYI6aqHup7ffYOnC46BiTOP1FUdu5EJDCn5krNU EdXYiyGDHqR83m8YoIlspGyUfX1Y1omUwGu0ExqMvCltQxBsLhZVE7vhN8qfGYKP pzJOTvhx3pghms+Cop1WJuqSoFIXVBJQ== 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=42LG7lnhXM4nQdalt unl/xuWUkND2BBE2vjPIJSpz2U=; b=Um8JwLCPGt09ghfJp+tMyTOYCSPinC8uY xHSL8qlHSuj/YUUP4mBKSS/+ldudU1N4tAcLJbLojdi3VDEh+Q8YwJsX0xfacx5Y VGia9p3BzIxAJZbt7zPkw2Ce+21HNjSsnwTyIHT/1AYrs8AGqUxmSIDr3+X3o+bo neaWIo+1NSxMTh1USiLSoGq9ZCFQBUXeA2L1kcWmtIX8GBj/r9FEhd9zk3vsqZqJ kksrHl35G9VNY8IWvl7inRBEOQl8XKI3kljEbujtucqZfhgjOYTZALZxbV+UO3AX hLjhPIz7WkVmjzBFhEt6wJEMm0/7J95lAdYPllZchgurYmaykaPdA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudeihedgtdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffujghffgffkfggtgesthdttd dttdertdenucfhrhhomhepufgvrghnucghhhhithhtohhnuceoshhpfihhihhtthhonhes shhpfihhihhtthhonhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeelgeeggfdvieejvd fhudfggeetgfekkeeuieeljeejhedugeegfeetgefhueffkeenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsphifhhhithhtohhnsehsphifhh hithhtohhnrdhnrghmvg X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 31 Mar 2022 17:55:42 -0400 (EDT) Original-Received: by melete.silentflame.com (Postfix, from userid 1000) id A43B87E1317; Thu, 31 Mar 2022 14:55:41 -0700 (MST) In-Reply-To: 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:229185 Archived-At: Hello, On Thu 31 Mar 2022 at 01:58PM -07, Jim Porter wrote: > I'm not so sure. That would mean "'foo" in "echo 'foo" is treated as a > Lisp form, but Eshell expects you to use "#'" (or "(" or "`") to > introduce a Lisp form. As I understand it, that's so that typos don't do > such surprising things. There's a good chance that a user typing "echo > 'foo" actually meant "echo 'foo'". Right okay. We can just skip over entire Lisp forms when we find them. I don't think there could be a non-highly esoteric shell command for standard POSIX shells -- which is what this feature is for -- which that would break. Like this: >> diff --git a/lisp/eshell/em-extpipe.el b/lisp/eshell/em-extpipe.el >> index eb5b3bfe1d..0787ab791b 100644 >> --- a/lisp/eshell/em-extpipe.el >> +++ b/lisp/eshell/em-extpipe.el >> @@ -99,7 +99,7 @@ eshell-parse-external-pipeline >> (let* ((found >> (save-excursion >> (re-search-forward >> - "\\(?:#?'\\|\"\\|\\\\\\)" bound t))) >> + "\\(?:(\\|#?'\\|\"\\|\\\\\\)" bound t))) >> (next (or (and found (match-beginning 0)) >> bound))) >> (if (re-search-forward pat next t) >> Something in my init.el is breaking the extpipe tests atm, but I ad hoc tested one of your cases for this bug and it works. Could you confirm? > That said, this isn't the only situation where "unbalanced" single > quotes can occur in an Eshell command. For example, see this command: > > echo $(list "one" "two")(:s'o'x') > > This creates a list of two strings, and then performs a regexp > substitution from "o" to "x", so the output is: > > ("xne" "twx") > > Under Emacs 27/28, this works correctly, but it fails in 29 for the > same reason as the original issue. The extpipe module could account > for this and try to parse argument predicates/modifiers so that it > knows when to stay out of things, but then what about configurations > where that module is disabled? (And for that matter, a third-party > Eshell module could cause conflicts in a similar manner.) I think the correct thing is for extpipe to do something sensible with all the Eshell syntax that is enabled by default. We should call the relevant parsing function to skip over these predicates/modifiers too. If you're changing the list of modules then you might have to drop extpipe as part of that process -- that's just inherent in how Eshell modules work. There's always going to be a limit to how much syntax you can have enabled at once. -- Sean Whitton