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#53518: 29.0.50; em-extpipe breaks input of sharp-quoted Lisp symbols Date: Tue, 25 Jan 2022 01:50:35 -0700 Message-ID: <87a6fk19no.fsf@athena.silentflame.com> References: <87h79s1isp.fsf@athena.silentflame.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22512"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , Michael Albinus To: 53518@debbugs.gnu.org, Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 25 10:08:16 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 1nCHo9-0005Qv-G6 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Jan 2022 10:08:11 +0100 Original-Received: from localhost ([::1]:47294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCHo7-0002tC-OJ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Jan 2022 04:08:07 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCHXb-0005kN-6z for bug-gnu-emacs@gnu.org; Tue, 25 Jan 2022 03:51:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nCHXZ-0007Ln-To for bug-gnu-emacs@gnu.org; Tue, 25 Jan 2022 03:51:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nCHXZ-0007BF-JJ for bug-gnu-emacs@gnu.org; Tue, 25 Jan 2022 03:51:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jan 2022 08:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53518 X-GNU-PR-Package: emacs Original-Received: via spool by 53518-submit@debbugs.gnu.org id=B53518.164310064627576 (code B ref 53518); Tue, 25 Jan 2022 08:51:01 +0000 Original-Received: (at 53518) by debbugs.gnu.org; 25 Jan 2022 08:50:46 +0000 Original-Received: from localhost ([127.0.0.1]:46839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCHXJ-0007Ai-SO for submit@debbugs.gnu.org; Tue, 25 Jan 2022 03:50:46 -0500 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:36785) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCHXG-0007AT-71 for 53518@debbugs.gnu.org; Tue, 25 Jan 2022 03:50:44 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id B792E5C01A7; Tue, 25 Jan 2022 03:50:36 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 25 Jan 2022 03:50:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm2; bh=pP2wswiicANKmS+f2KomVhjEj3QJ+MEHZlCD90 Cg4eQ=; b=LyMt71ORYTRaZ56huCMdGKQr6MaZ8h4AvkgE2ei7JGAdZQ4LITJGVo vPGrenfwde2FtrBEZm7+97++3m71VARWIELs1w5b9HjUcslCHH/NiGJXpVrtgZAQ QmkCe+EJzuof+EVdpsL9CnDzV3JSRD40srssW5GUKcGPJ7N/MJBYVw3l3XEbcY16 akuavSZAn1qKXmlJy7abqK/oXop1rcCPw1tRlTrFPw1xyBpUWodhmyWbl7i1t987 28fN0sMDrnP4EIAe3xfXel2gwPSpQU9o5Sk8fMgtshCqIJVaKtuwvki9kSKOfBof BOaXVc9w3/cJEq8TbrJW7Oo1FSo9ilmw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=pP2wswiicANKmS+f2KomVhjEj3QJ+ MEHZlCD90Cg4eQ=; b=l/pH7A6RzulppShIaFXPJXHbMSDk8VvVewyZ77rKGDpXc /Fr1rUm0jzf0mTbL8TCVk56DGZirzRnMi926rXzT9hdl6/Msqxz/eSrbHykTJOml dGHsuyU51ChUZOxSedw9t5CiKsiw/hWSk/q7w5/CbWv2+wo+v6pCiapgf3TcueRf yyFq2YBNiQ9JfSBzD6t7Vv+FrHXhP/QokPlmtXt5EsYLQT6GY0y2DbMDOTbd/I4G hbrR1gC6NSYlhK2ohX7bd7aYtbqdwk2DU5R7ghKFVqkmwz0m8w+ZmvJoxTjvPoID LMRUEY70U8uc7w4nBPmtJ7e/veOp/cQjJIf3qFdXA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrvdekgdduvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfffkgggtsehmtddtredttddtnecuhfhrohhmpefuvggrnhcuhghh ihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqnecugg ftrfgrthhtvghrnhepleefffdvvefhgfehudeugefggfeffedvvdffuedvvdelgffghfff leehheetffehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Jan 2022 03:50:36 -0500 (EST) Original-Received: by athena.silentflame.com (Postfix, from userid 1000) id 207A11B6048; Tue, 25 Jan 2022 08:50:35 +0000 (UTC) In-Reply-To: <639b931e-7816-ef07-510c-71178ff19fff@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:225149 Archived-At: --=-=-= Content-Type: text/plain Hello again, On Mon 24 Jan 2022 at 06:39pm -08, Jim Porter wrote: > I just noticed a small bit of breakage with this. It's no longer > possible to refer to Lisp functions in Eshell like so: > > #'upcase > > Eshell explicitly supports this construct (see `eshell-lisp-regexp'), > though it doesn't appear to be documented in the manual. Currently, this > syntax is only occasionally useful, but I'm working on a patch series > where it'll likely become a lot more common. My patches will add support > for piping to Lisp functions, so that you can do the following, for example: > > $ echo hi | #'upcase > HI Out of curiosity, why is there a need for the sharpquote? Why not just 'echo hi | upcase'? Is it to do with requesting the new piping? > It looks like the breakage in parsing #'upcase is the result of > `eshell-parse-external-pipeline' trying to skip over args like '*|' > (with the quotes). However, it sees the single-quote in #'upcase and > then calls `eshell-parse-literal-quote', resulting in the error message: > > Expecting completion of delimiter ' ... Here is a patch which has `eshell-parse-external-pipeline' try skipping over sharp-quoted symbols before trying to skip over single-quoted strings. -- Sean Whitton --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fix-input-of-sharp-quoted-symbols-in-Eshell-with-em-.patch >From 8725495cb91ebf831cd623c58f84a4347e6f1651 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 24 Jan 2022 22:39:15 -0700 Subject: [PATCH] Fix input of sharp-quoted symbols in Eshell with em-extpipe * lisp/eshell/em-extpipe.el (eshell-parse-external-pipeline): Fix misinterpreting sharp-quoted symbols as the beginning of single-quoted strings (Bug#53518). Add protection against a possible infinite loop. * test/lisp/eshell/em-extpipe-tests.el (em-extpipe-test-17): New test. --- lisp/eshell/em-extpipe.el | 12 +++++++++--- test/lisp/eshell/em-extpipe-tests.el | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lisp/eshell/em-extpipe.el b/lisp/eshell/em-extpipe.el index 57aeec38ff..b0f92e41dc 100644 --- a/lisp/eshell/em-extpipe.el +++ b/lisp/eshell/em-extpipe.el @@ -97,15 +97,21 @@ eshell-parse-external-pipeline (while (> bound (point)) (let* ((found (save-excursion - (re-search-forward "['\"\\]" bound t))) + (re-search-forward + "\\(?:#?'\\|\"\\|\\\\\\)" bound t))) (next (or (and found (match-beginning 0)) bound))) (if (re-search-forward pat next t) (throw 'found (match-beginning 1)) (goto-char next) - (while (or (eshell-parse-backslash) + (while (or (eshell-parse-lisp-argument) + (eshell-parse-backslash) (eshell-parse-double-quote) - (eshell-parse-literal-quote))))))))) + (eshell-parse-literal-quote))) + ;; Guard against an infinite loop if none of + ;; the parsers moved us forward. + (unless (or (> (point) next) (eobp)) + (forward-char 1)))))))) (goto-char (if (and result go) (match-end 0) start)) result))) (unless (or eshell-current-argument eshell-current-quoted) diff --git a/test/lisp/eshell/em-extpipe-tests.el b/test/lisp/eshell/em-extpipe-tests.el index 1283b6b361..0879ad5b0c 100644 --- a/test/lisp/eshell/em-extpipe-tests.el +++ b/test/lisp/eshell/em-extpipe-tests.el @@ -202,4 +202,8 @@ em-extpipe-test-16 (eshell-command-result-p input "rab") (eshell-command-result-p "echo \"bar\" | rev" "nonsense")))) +;; Confirm we don't break input of sharp-quoted symbols (Bug#53518). +(em-extpipe-tests--deftest em-extpipe-test-17 "funcall #'upcase foo" + (eshell-command-result-p input "FOO")) + ;;; em-extpipe-tests.el ends here -- 2.30.2 --=-=-=--