From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#54603: 29.0.50; [PATCH] Eshell's external pipe module interferes with other argument parsing hooks Date: Sun, 27 Mar 2022 19:21:17 -0700 Message-ID: <70677cd2-f741-16d1-b38f-c39b507cc95e@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------65E6C01A67BB579D5821A1F0" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19359"; mail-complaints-to="usenet@ciao.gmane.io" To: 54603@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 28 04:22:12 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 1nYf1I-0004v4-03 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Mar 2022 04:22:12 +0200 Original-Received: from localhost ([::1]:44200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYf1G-0007Va-MW for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Mar 2022 22:22:10 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYf18-0007TR-SX for bug-gnu-emacs@gnu.org; Sun, 27 Mar 2022 22:22:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nYf18-0004CX-K0 for bug-gnu-emacs@gnu.org; Sun, 27 Mar 2022 22:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nYf18-0002zd-B0 for bug-gnu-emacs@gnu.org; Sun, 27 Mar 2022 22:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Mar 2022 02:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54603 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164843409611469 (code B ref -1); Mon, 28 Mar 2022 02:22:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Mar 2022 02:21:36 +0000 Original-Received: from localhost ([127.0.0.1]:56885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nYf0i-0002yv-5X for submit@debbugs.gnu.org; Sun, 27 Mar 2022 22:21:36 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:41326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nYf0g-0002ym-43 for submit@debbugs.gnu.org; Sun, 27 Mar 2022 22:21:34 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYf0f-0006z3-89 for bug-gnu-emacs@gnu.org; Sun, 27 Mar 2022 22:21:33 -0400 Original-Received: from [2607:f8b0:4864:20::102e] (port=41853 helo=mail-pj1-x102e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nYf0Z-00043r-HW for bug-gnu-emacs@gnu.org; Sun, 27 Mar 2022 22:21:30 -0400 Original-Received: by mail-pj1-x102e.google.com with SMTP id l4-20020a17090a49c400b001c6840df4a3so14107674pjm.0 for ; Sun, 27 Mar 2022 19:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:subject:to:message-id:date:mime-version:content-language; bh=UzZWQu4EkKsUjc6+EVOH/qFScvSF6FqRPzOVFSuJjRE=; b=FstrzTolYW/bqeiHgiuE4jOOpHHXCG1L0fB48XtYSfxKGq5rDXQ8IpNq+SH0NAT6C4 2GiRmXNNYzLhrFac7ITVTmUSKO4lN6BiaNQzy8hKwC2Iq8YMAJTVLTkfZfmRhAuCZiHa NyFlELj+SHYs7AbckQ5Uqr2yid8XD20Czn4ZadGfDwfdKSN+aYwU5h8TyNxsxUjwwqhZ Zq6MVwwECVARH8MsHOMyWQL97rUA8zRnEhB6OOf+WOxHknNe2ZKYQtBOa7ZDzNu9SbZ4 j9QrBBSyzSJJV8pv0Pe/OivyDIyGKOCFDMfQ9EPew3MKE4ZsOw0co5yv/bJwf7dNqjNH LXuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:subject:to:message-id:date:mime-version :content-language; bh=UzZWQu4EkKsUjc6+EVOH/qFScvSF6FqRPzOVFSuJjRE=; b=J20BLcWoPMRHisHpOaUa50gmPLkxgZrGmu6v8+fjg5tkTfsWhzkY7NVWenAecFc9pE ovxfMJ01s1rghV886Qu0RQyZ6C73Gfu1mtE8ju3ahuOrwJNltTlmJOSDLUnFYKuCd5od qeAdQ3gJDzAD1xcSPKY8NOGdh6W+chRV7pndlzJTQpB7nTdrBpp3G45qogEB6VZdLRDW y5SwqaBJTFdTQ74GayAeDwE6ez/zoC0/7gkqrpRUPXPJVBv1uZoEdGBEKnPkQQ9rpFKY beVEJlo4DlKD3xyCZ949HwUg+Mpvu2zoEL2Iw/KfDCoh9UecpZxbOgdG1QlB7GIQgofI wi2g== X-Gm-Message-State: AOAM533HPntT4ixW+z1L2DyANJB2P3QptCiWQVfrRX7BWU0sQ6PkADbD S6+WeIs3rVQc5xpXylp6VpffwldnqrI= X-Google-Smtp-Source: ABdhPJzqcHYQ2ONS6UGqGU/ec4fwQJ2Yca5tooAlw7E7mVFravqXojuIV07xyJUA9usROFgftPq/IA== X-Received: by 2002:a17:90b:1c07:b0:1c7:5324:c68e with SMTP id oc7-20020a17090b1c0700b001c75324c68emr26517329pjb.202.1648434078398; Sun, 27 Mar 2022 19:21:18 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id j18-20020a633c12000000b0038204629cc9sm11477714pga.10.2022.03.27.19.21.17 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Mar 2022 19:21:17 -0700 (PDT) X-Mozilla-News-Host: news://news.gmane.org:119 Content-Language: en-US X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=jporterbugs@gmail.com; helo=mail-pj1-x102e.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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:228999 Archived-At: This is a multi-part message in MIME format. --------------65E6C01A67BB579D5821A1F0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit From "emacs -Q --eval '(eshell)': ~ $ (eq 'foo nil) Expecting completion of delimiter ' ... M-: (unload-feature 'em-extpipe) ~ $ (eq 'foo nil) ;; No output, since it returns nil. This is correct. (As an ironic twist, you'd normally be able to run "(unload-feature 'em-extpipe)" as a command in Eshell, but this bug prevents that from working.) I don't fully understand all the details of the code in lisp/eshell/em-extpipe.el yet, but I think this is the culprit: (while (or (eshell-parse-lisp-argument) (eshell-parse-backslash) (eshell-parse-double-quote) (eshell-parse-literal-quote))) In particular, since there are 3 single-quotes, `eshell-parse-literal-quote' throws an `eshell-incomplete' error, which gums up the works. The attached patch resolves the issue for me, but I'm not sure if it's the best strategy. 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.) [1] See `eshell-parse-delimiter' for an example of how that might be implemented. [2] Well, maybe there's room for debate on what the right behavior here is. --------------65E6C01A67BB579D5821A1F0 Content-Type: text/plain; charset=UTF-8; name="0001-Make-Eshell-s-extpipe-more-lenient-when-looking-for-.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-Make-Eshell-s-extpipe-more-lenient-when-looking-for-.pa"; filename*1="tch" RnJvbSBmYWI0OGEyOGZmODBmMWM3NGYyZDUwZDRmNjllZGIwNTZmODhkMTE5IE1vbiBTZXAg MT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lwZS5lbApAQCAtMTA1LDEw ICsxMDUsMTEgQEAgZXNoZWxsLXBhcnNlLWV4dGVybmFsLXBpcGVsaW5lCiAgICAgICAgICAg ICAgICAgICAgICAgIChpZiAocmUtc2VhcmNoLWZvcndhcmQgcGF0IG5leHQgdCkKICAgICAg ICAgICAgICAgICAgICAgICAgICAgICh0aHJvdyAnZm91bmQgKG1hdGNoLWJlZ2lubmluZyAx KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAoZ290by1jaGFyIG5leHQpCi0gICAgICAg ICAgICAgICAgICAgICAgICAgKHdoaWxlIChvciAoZXNoZWxsLXBhcnNlLWxpc3AtYXJndW1l bnQpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZXNoZWxsLXBhcnNl LWJhY2tzbGFzaCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChlc2hl bGwtcGFyc2UtZG91YmxlLXF1b3RlKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgKGVzaGVsbC1wYXJzZS1saXRlcmFsLXF1b3RlKSkpCisgICAgICAgICAgICAgICAg ICAgICAgICAgKGNhdGNoICdlc2hlbGwtaW5jb21wbGV0ZQorICAgICAgICAgICAgICAgICAg ICAgICAgICAgKHdoaWxlIChvciAoZXNoZWxsLXBhcnNlLWxpc3AtYXJndW1lbnQpCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChlc2hlbGwtcGFyc2UtYmFja3Ns YXNoKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZXNoZWxsLXBh cnNlLWRvdWJsZS1xdW90ZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgKGVzaGVsbC1wYXJzZS1saXRlcmFsLXF1b3RlKSkpKQogICAgICAgICAgICAgICAgICAg ICAgICAgIDs7IEd1YXJkIGFnYWluc3QgYW4gaW5maW5pdGUgbG9vcCBpZiBub25lIG9mCiAg ICAgIC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