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#57129: 29.0.50; Improve behavior of conditionals in Eshell Date: Sat, 13 Aug 2022 22:37:12 -0700 Message-ID: <9ca08054-5b73-a13e-0478-d838b650317b@gmail.com> References: <8fb3461d-b7eb-23c4-2736-cdd6dfeb1aa0@gmail.com> <87mtc9o5af.fsf@gnus.org> <83h72gmxtq.fsf@gnu.org> <7c04a92b-85f4-41c3-917b-4716cca2b9d6@gmail.com> <83pmh3l8ey.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1679FDC9C3768559027CA3F9" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14828"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 57129@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 14 07:39:41 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 1oN6Lb-0003er-Fn for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Aug 2022 07:39:39 +0200 Original-Received: from localhost ([::1]:60224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oN6La-00022L-Eg for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Aug 2022 01:39:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oN6K3-00021C-LM for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 01:38:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oN6K2-0003v6-LR for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 01:38:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oN6K2-0006RL-HK for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 01:38: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: Sun, 14 Aug 2022 05:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57129 X-GNU-PR-Package: emacs Original-Received: via spool by 57129-submit@debbugs.gnu.org id=B57129.166045544724702 (code B ref 57129); Sun, 14 Aug 2022 05:38:02 +0000 Original-Received: (at 57129) by debbugs.gnu.org; 14 Aug 2022 05:37:27 +0000 Original-Received: from localhost ([127.0.0.1]:35645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oN6JR-0006QL-9j for submit@debbugs.gnu.org; Sun, 14 Aug 2022 01:37:27 -0400 Original-Received: from mail-pl1-f172.google.com ([209.85.214.172]:40905) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oN6JL-0006Q3-E5 for 57129@debbugs.gnu.org; Sun, 14 Aug 2022 01:37:23 -0400 Original-Received: by mail-pl1-f172.google.com with SMTP id x23so3944816pll.7 for <57129@debbugs.gnu.org>; Sat, 13 Aug 2022 22:37:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-language:in-reply-to:mime-version:date:message-id:from :references:cc:to:subject:from:to:cc; bh=HocWahDv5Qht2tm0dREWw201fk24lC4CZutx97AdDHA=; b=YISQGFBDqpDi2YC4fuCgVVvaPWb0bnUNCj6/gQrHY5lA4BUfisyvoPDG8y00itTZJS Br5t/wIFQXtkFMlZgZ3ntRd+NCmHso/FNtZOF22T64bGchwai3m++fk/skhCafwXjv44 inChUZn1CZwwCMSC9Doz8kaCqPLNtSLhiH3mL/BfS/0bi090dR2ukFq7zICwdH7EM/mS ICZu5AUMKqkNXgI2tLK13d8QajLjAnvcg1MTbRqs06tgDnWg6S0GsRIvZgdBi3ct19K3 V814By+CATMQDbiudfMbqxptLEcd6DN4XiqeZcmrktKX4YUgCQ8s3BeSca0yVfKaVUA6 MW1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-language:in-reply-to:mime-version:date:message-id:from :references:cc:to:subject:x-gm-message-state:from:to:cc; bh=HocWahDv5Qht2tm0dREWw201fk24lC4CZutx97AdDHA=; b=AHRg+P2Hl0uOueJzLKJdg5WLMmkTwC27N8XMAU2cpNpPNyuSB1kOeamP69AcrQyAoe quGKvTdv18UrI4C/UkeG3hvsX4YDiCQRSvUly0a7ujd0FJWkde/4Z1w31ITBAGUaBpXZ g9pt45/vIHdiqZgkAKkU2BJvUBd7jN2ZWGW3ttStMCMPu9BwcoIUskI01NaymWDMg5kC mwntWh5EutOz3de8dPRNrI5DeoP1zNGPSsxhqxzMJKYqE/Fkf4NqQqn4bNb/Xm8UmJWW 3j7jhBMYcSAuDgFc2R+igfvdb8ttEeuSovoHo7QgWWw0gO8ACVxbVqBLclxh72KyXuLa giXw== X-Gm-Message-State: ACgBeo3SkqMKnkllMg1KeZ2K9LNQfM8t0UWPq16zVot6sMNRCxDGvf0R zgNFGToqOz56EN/fbraL9q2G2MtXH5A= X-Google-Smtp-Source: AA6agR4VVaJaquNprAfA5LHHQ7JqjlEItZc97k4NAMEC3LJUHBObfOyqEmou3JnOn/IErYT0cV4gUw== X-Received: by 2002:a17:902:d144:b0:170:cabe:a719 with SMTP id t4-20020a170902d14400b00170cabea719mr11265335plt.76.1660455433407; Sat, 13 Aug 2022 22:37:13 -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 b14-20020a170902d50e00b0016dc1df9bf7sm4685617plg.27.2022.08.13.22.37.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 Aug 2022 22:37:12 -0700 (PDT) In-Reply-To: <83pmh3l8ey.fsf@gnu.org> Content-Language: en-US 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:239617 Archived-At: This is a multi-part message in MIME format. --------------1679FDC9C3768559027CA3F9 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 8/13/2022 10:07 PM, Eli Zaretskii wrote: >> Cc: larsi@gnus.org, 57129@debbugs.gnu.org >> From: Jim Porter >> Date: Sat, 13 Aug 2022 11:56:20 -0700 >> >> Sorry about that. I think that's the right fix for that case. Maybe it >> would make sense to set 'eshell-prefer-lisp-functions' to t for most of >> the Eshell tests to improve reproducibility on various platforms; tests >> that want an external command can just put a "*" in front of the command >> name. > > But then this fragment from the Eshell manual: > > The command can be either an Elisp function or an external command. > Eshell looks first for an alias (*note Aliases::) with the same name as > the command, then a built-in (*note Built-ins::) or a function with the > same name; if there is no match, it then tries to execute it as an > external command. > > seems to be inaccurate? Since 'format' exists as a built-in command, > why did Eshell in this case invoke the external command instead? "Built-in" in that part of the manual refers to a function named 'eshell/FOO'. If you run "FOO" as an Eshell command, it will check for 'eshell/FOO' before an external command on your system. The manual could probably stand to be improved here. >> I'm surprised that test fails on MS Windows, since it *should* be >> testing internal Eshell logic that's not platform-specific. Based on the >> failure, it looks like one of the following commands is returning the >> wrong value: >> >> echo {echo $eshell-in-pipeline-p | echo} | *cat >> echo ${echo $eshell-in-pipeline-p | echo} | *cat >> *cat $ | *cat >> >> All of these should return 'first'. > > The first two do; the last one returns nothing. [snip] > So how to investigate this failure further? I have access to an MS Windows system (but don't have a build environment set up for native MS Windows builds), so I can try to reproduce this using the Emacs 29 pretest binaries in the next few days. Hopefully that works. If you'd like to dig into this further yourself, you could try running this command in Eshell: eshell-parse-command '*cat $ | *cat' That will print the Lisp form that the command gets converted to. I've attached the result that I get in a recent Emacs 29 build on GNU/Linux. The two functions that set 'eshell-in-pipeline-p' in there are: * 'eshell-as-subcommand', which resets it to nil so that the outer command's pipeline state doesn't interfere with the subcommand. * 'eshell-execute-pipeline', which calls 'eshell-do-pipelines' (except on MS-DOS, I think) and should set 'eshell-in-pipeline-p' to 'first' in the above case. >> If nothing else, it would probably be helpful to set up ERT explainers >> so that the error messages are easier to understand. As it is now, >> they're not very explanatory. > > Indeed, more explanations in this and other tests will be most > welcome. Yeah, this test in particular is high up on the list of tests that needs more explanation. It's pretty subtle, and the test doesn't really serve as a good example of why someone would care that this behavior works the way the test demands it. --------------1679FDC9C3768559027CA3F9 Content-Type: text/plain; charset=UTF-8; name="parsed-command.el" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="parsed-command.el" KGVzaGVsbC10cmFwLWVycm9ycwogKGVzaGVsbC1leGVjdXRlLXBpcGVsaW5lCiAgJygoZXNo ZWxsLW5hbWVkLWNvbW1hbmQKICAgICAoZXNoZWxsLWNvbmNhdCBuaWwgIioiICJjYXQiKQog ICAgIChsaXN0CiAgICAgIChlc2hlbGwtZXNjYXBlLWFyZwogICAgICAgKGxldAogICAgICAg ICAgICgoaW5kaWNlcwogICAgICAgICAgICAgKGVzaGVsbC1ldmFsLWluZGljZXMgJ25pbCkp KQogICAgICAgICAobGV0CiAgICAgICAgICAgICAoKGVzaGVsbC1jdXJyZW50LWhhbmRsZXMK ICAgICAgICAgICAgICAgKGVzaGVsbC1jcmVhdGUtaGFuZGxlcyAiL3RtcC9RcVBGd28iICdv dmVyd3JpdGUpKSkKICAgICAgICAgICAocHJvZ24KICAgICAgICAgICAgIChlc2hlbGwtYXMt c3ViY29tbWFuZAogICAgICAgICAgICAgIChlc2hlbGwtdHJhcC1lcnJvcnMKICAgICAgICAg ICAgICAgKGVzaGVsbC1leGVjdXRlLXBpcGVsaW5lCiAgICAgICAgICAgICAgICAnKChlc2hl bGwtbmFtZWQtY29tbWFuZCAiZWNobyIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIChsaXN0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgKGVzaGVsbC1lc2NhcGUtYXJnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIChsZXQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICgoaW5kaWNlcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAoZXNoZWxsLWV2YWwtaW5kaWNlcyAnbmlsKSkpCiAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGVzaGVsbC1nZXQtdmFyaWFibGUKICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIygiZXNoZWxsLWlu LXBpcGVsaW5lLXAiIDAgMjAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAoZXNjYXBlZCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgaW5kaWNlcyBuaWwpKSkpKQogICAgICAgICAgICAgICAgICAocHJv Z24KICAgICAgICAgICAgICAgICAgICAoaWdub3JlCiAgICAgICAgICAgICAgICAgICAgIChl c2hlbGwtc2V0LW91dHB1dC1oYW5kbGUgMSAnb3ZlcndyaXRlICIvdG1wL1FxUEZ3byIpKQog ICAgICAgICAgICAgICAgICAgIChlc2hlbGwtbmFtZWQtY29tbWFuZCAiZWNobyIpKSkpKSkK ICAgICAgICAgICAgIChpZ25vcmUKICAgICAgICAgICAgICAobmNvbmMgZXNoZWxsLXRoaXMt Y29tbWFuZC1ob29rCiAgICAgICAgICAgICAgICAgICAgIChsaXN0CiAgICAgICAgICAgICAg ICAgICAgICAjJyhsYW1iZGEgbmlsCiAgICAgICAgICAgICAgICAgICAgICAgICAgKGRlbGV0 ZS1maWxlICIvdG1wL1FxUEZ3byIpKSkpKQogICAgICAgICAgICAgKGVzaGVsbC1hcHBseS1p bmRpY2VzICIvdG1wL1FxUEZ3byIgaW5kaWNlcyBuaWwpKSkpKSkpCiAgICAoZXNoZWxsLW5h bWVkLWNvbW1hbmQKICAgICAoZXNoZWxsLWNvbmNhdCBuaWwgIioiICJjYXQiKSkpKSkK --------------1679FDC9C3768559027CA3F9--