From unknown Sat Jun 21 03:08:11 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#26161 <26161@debbugs.gnu.org> To: bug#26161 <26161@debbugs.gnu.org> Subject: Status: 25.1; `eshell-exit-success-p' determines that Lisp commands are successful if they return non-nil Reply-To: bug#26161 <26161@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:08:11 +0000 retitle 26161 25.1; `eshell-exit-success-p' determines that Lisp commands a= re successful if they return non-nil reassign 26161 emacs submitter 26161 "George D. Plymale" severity 26161 minor tag 26161 confirmed fixed patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 18 17:21:08 2017 Received: (at submit) by debbugs.gnu.org; 18 Mar 2017 21:21:08 +0000 Received: from localhost ([127.0.0.1]:34377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpLmc-000219-Pl for submit@debbugs.gnu.org; Sat, 18 Mar 2017 17:21:07 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpJmi-0007At-Fl for submit@debbugs.gnu.org; Sat, 18 Mar 2017 15:13:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpJmc-0003lx-5x for submit@debbugs.gnu.org; Sat, 18 Mar 2017 15:12:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.4 required=5.0 tests=BAYES_50,HTML_IMAGE_ONLY_20, HTML_MESSAGE,T_DKIM_INVALID,T_REMOTE_IMAGE autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51057) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cpJmc-0003lt-2l for submit@debbugs.gnu.org; Sat, 18 Mar 2017 15:12:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpJma-0008Jt-Jy for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2017 15:12:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpJmV-0003lB-Iu for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2017 15:12:56 -0400 Received: from mail-qk0-x22c.google.com ([2607:f8b0:400d:c09::22c]:35765) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cpJmV-0003ky-Cv for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2017 15:12:51 -0400 Received: by mail-qk0-x22c.google.com with SMTP id v127so86457735qkb.2 for ; Sat, 18 Mar 2017 12:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orbitalimpact.com; s=google; h=from:mime-version:subject:date:to:message-id; bh=D1SkGauQrkTIJFQUnTr0VpUTwACqHOj89ifzXgL2oOE=; b=mx4DZS/NvEYJliGEyXlHrKOTgmRTA7l1CwJ4aFWK7UUHrJXEi/kSQ7bJYpA2BWY2CB RlKEXt/44e205g2ynqtf2GzI2luFst6B50nYZRoehcabk6et7RR+xLzp93K29f4o6kYt o3q3+P6dZe+bL8VyTzLW6Bcau8CpKtcmicigU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:to:message-id; bh=D1SkGauQrkTIJFQUnTr0VpUTwACqHOj89ifzXgL2oOE=; b=GE4vwM1vPcVkXZN9Qf0S6bYBM67NboHQHefDxMCvqbCGUFf8qgzMxqJc1r5/7tYcfp mV1l+ZU+7AIbH9/VGXE5RKOcN2zLAc9VoOsAJ63B+ZaLvDB5vfIJWLwa1Md7yINFZ1ls fuxQtS/vGEsu0eY3jr8OKt8Prx6aTZ+EU2k0KlKatFvIbtMaLE5K6tHwk10bBC3MS0re rgubN0fBicVtbDgDtGSMSa8QvlwBH4/AaOrmmv3hbeJd6klejNB1ihmM0OXx1UGoHBc/ mfDy3mAzWvaWY8n3fXT3TBu3a3hdWmMaCiyPYxPt5fq7Ocaqe/NRC48PSuuDd/xZBNT7 D3lg== X-Gm-Message-State: AFeK/H0O1hncEY7luR+2CTZ/gYuLfi4J9SNS2F3B540jGpHNJM6kp2UnaXPeADiZXZVClg== X-Received: by 10.233.216.68 with SMTP id u65mr17066785qkf.37.1489864370285; Sat, 18 Mar 2017 12:12:50 -0700 (PDT) Received: from [10.48.10.6] ([208.167.254.34]) by smtp.gmail.com with ESMTPSA id l20sm8713653qtc.5.2017.03.18.12.12.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Mar 2017 12:12:49 -0700 (PDT) From: "George D. Plymale" X-Mailbutler-Tracking-Uuid: 95BC6D55-B8CD-475E-8C35-9DC0427E169D Content-Type: multipart/alternative; boundary="Apple-Mail=_30728047-A5A0-4E20-BBA5-59EC09ED67DA" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: 25.1; `eshell-exit-success-p' determines that Lisp commands are successful if they return non-nil Date: Sat, 18 Mar 2017 15:12:41 -0400 X-Mailbutler-Link-Tracking-Uuid: To: bug-gnu-emacs@gnu.org Message-Id: <7E4E5778-FFBF-4298-9DEF-0A60539999D5@orbitalimpact.com> X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 18 Mar 2017 17:21:05 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) --Apple-Mail=_30728047-A5A0-4E20-BBA5-59EC09ED67DA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi, I believe that it is sub-optimal behavior for `eshell-exit-success-p' to determine that Lisp commands are successful by checking whether or not they return a non-nil value. A demonstration of why this behavior can be considered problematic is found in a command like this: `$ cd .. && pwd' Such a command will not execute its second part (which is `pwd') because `eshell/cd' returns a nil value whether it's successful or not. This behavior is a bit confusing for someone who expects common shell operators such as `&&' to "just work." A better solution would be to check whether the last command threw an actual error. Thanks, - George Plymale II In GNU Emacs 25.1.1 (x86_64-apple-darwin16.1.0, NS appkit-1504.60 = Version 10.12.1 (Build 16B2657)) of 2016-11-14 built on [REDACTED] Repository revision: f0eb70d8935be90f7c03e187c12d9b60e7214cc6 Windowing system distributor 'Apple', version 10.3.1504 Configured using: 'configure --with-ns' --Apple-Mail=_30728047-A5A0-4E20-BBA5-59EC09ED67DA Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Hi,

I believe that it is = sub-optimal behavior for `eshell-exit-success-p' to
determine that Lisp commands are successful by checking = whether or not
they return a non-nil value. A = demonstration of why this behavior can be
considered = problematic is found in a command like this: `$ cd .. && pwd'

Such a command will not execute its second = part (which is `pwd') because
`eshell/cd' returns a nil = value whether it's successful or not. This
behavior is a = bit confusing for someone who expects common shell
operators= such as `&&' to "just work."

A = better solution would be to check whether the last command threw an
actual error.

Thanks,

- George Plymale II

In GNU Emacs 25.1.1 (x86_64-apple-darwin16.1.0, NS = appkit-1504.60 Version 10.12.1 (Build 16B2657))
of = 2016-11-14 built on [REDACTED]
Repository revision: = f0eb70d8935be90f7c03e187c12d9b60e7214cc6
Windowing system = distributor 'Apple', version 10.3.1504
Configured = using:
'configure --with-ns'



3D""= --Apple-Mail=_30728047-A5A0-4E20-BBA5-59EC09ED67DA-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 30 23:51:25 2017 Received: (at 26161) by debbugs.gnu.org; 31 Mar 2017 03:51:25 +0000 Received: from localhost ([127.0.0.1]:53415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctnav-0003u7-Ib for submit@debbugs.gnu.org; Thu, 30 Mar 2017 23:51:25 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:33911) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctnas-0003tj-RJ; Thu, 30 Mar 2017 23:51:23 -0400 Received: by mail-io0-f194.google.com with SMTP id n76so4880561ioe.1; Thu, 30 Mar 2017 20:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=UnxLVPjC3OeGsBCwUsQSqCcQdDHscF7TDofGVQiN8iE=; b=HuPOK8gj6KONykfX19EatWTriBg4gnIspjjGMAwBBwj8DOgddzcgzaUTf29TgS7x27 dRpIqIJ7N2sRF2FR6uP9LgnXDz+0dwND32Y282EEZwiz+m/kxGG3qYMlNTfE64QbEdCT 6915pA/z8oQKUOfHCGYl8j3gINpkmQl8iTASMp+nV3pX4IURfQZIIS7/PJWyfICaWRAy Y8FrE3S/ccb03GB93zbKSYqUrxjpUa0DyVTWlW9VynI5F5aStJ+rURnzC5EGIsGmKGjo CLlSa7zxJgvco77trfGYh7nKs2caBJ/REsR8JCSTosj+XNA9SSzblM2pBv3n4CvLUmfc obxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=UnxLVPjC3OeGsBCwUsQSqCcQdDHscF7TDofGVQiN8iE=; b=SL+pmDFuAbfWe7an9StPjvUf7DxctYLNtMNySeB1AofQI3SH8Bo5bwP4qP/65h+JJ5 C4h8D9C5TispZMdp3c+oYnKgST59fYhWa6sSKWzQJraHsb/2UY+ZpbIXA0blYkIl9fgC KsFi+JFXajEdpZHIa6CktDE8MP6L846wmBZOF+TaU67y6LMH1ghu87dPqW/QwsIaELdC xz7hJwJIqq/LUKlPpi2H9dEPbLQbKAaLbZ8P+3eOjkVgKaDg2lXDVcFGpgaJsJejoEb3 LrnGdeKrZDSVaD7hi3Ryf0nqSz1SsU71QQ4vInwodxA5cVSqaAUXtGoD/BD3uIG0FLI9 cwNQ== X-Gm-Message-State: AFeK/H2i1ZB/0UIm0Wk6f9OaH5bpINbR02XXmRSwPaYZ0AjOPhRje8LDDkH//mf3XlksKQ== X-Received: by 10.107.133.159 with SMTP id p31mr939326ioi.101.1490932277262; Thu, 30 Mar 2017 20:51:17 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id f196sm2440936itc.2.2017.03.30.20.51.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Mar 2017 20:51:16 -0700 (PDT) From: npostavs@users.sourceforge.net To: "George D. Plymale" Subject: Re: bug#26161: 25.1; `eshell-exit-success-p' determines that Lisp commands are successful if they return non-nil References: <7E4E5778-FFBF-4298-9DEF-0A60539999D5@orbitalimpact.com> Date: Thu, 30 Mar 2017 23:52:39 -0400 In-Reply-To: <7E4E5778-FFBF-4298-9DEF-0A60539999D5@orbitalimpact.com> (George D. Plymale's message of "Sat, 18 Mar 2017 15:12:41 -0400") Message-ID: <87shlu14s8.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 26161 Cc: 26161@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) tags 26161 confirmed severity 26161 minor quit "George D. Plymale" writes: > I believe that it is sub-optimal behavior for `eshell-exit-success-p' to > determine that Lisp commands are successful by checking whether or not > they return a non-nil value. A demonstration of why this behavior can be > considered problematic is found in a command like this: `$ cd .. && pwd' So maybe `eshell/cd' should be changed to return t when it succeeds? > Such a command will not execute its second part (which is `pwd') because > `eshell/cd' returns a nil value whether it's successful or not. This > behavior is a bit confusing for someone who expects common shell > operators such as `&&' to "just work." > > A better solution would be to check whether the last command threw an > actual error. AFAICT, when you cd to a non-existent directory it doesn't throw an error, but I don't think that should be considered success. From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 01 19:46:14 2017 Received: (at 26161) by debbugs.gnu.org; 1 Apr 2017 23:46:14 +0000 Received: from localhost ([127.0.0.1]:56100 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuSik-0002Jr-6C for submit@debbugs.gnu.org; Sat, 01 Apr 2017 19:46:14 -0400 Received: from mail-qk0-f170.google.com ([209.85.220.170]:35342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuSih-0002JX-U8 for 26161@debbugs.gnu.org; Sat, 01 Apr 2017 19:46:12 -0400 Received: by mail-qk0-f170.google.com with SMTP id g195so19478883qke.2 for <26161@debbugs.gnu.org>; Sat, 01 Apr 2017 16:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orbitalimpact.com; s=google; h=from:mime-version:subject:date:cc:to:message-id; bh=hl4qSUSzb8nfZUbhIkatp9RpUi5PNGCoxJibT7LH1eg=; b=wSGFtMgzs45YAOct5wZe6AKfP3sSLctw/5CTC8dzNXRghqK3RexjM+4aTjyoZQmEBZ 71Ax3veXz+XOCF/Oetytm3sKO65NH0HSB3S6V9hwIyi6Zcv2y2WYYIEXpTDGhjzHdTgv ZP9QwGncx3+ua7KsydJ0OOxl9yDBD7OzbJWSo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:cc:to:message-id; bh=hl4qSUSzb8nfZUbhIkatp9RpUi5PNGCoxJibT7LH1eg=; b=mZ0m21J0CHCvrXsN3bvdr7AGLYnwXNLs0gvOHdQGn0j5BBU8PzPQ+EHh141zaIAqgT 4fsKPe6RzIS6xdxokktIwfA4FCd9EM+dwg7bZfm32DsYkcMCFrlwIcieXJW2ysTuHCGW Ifvt7zXq4qMxN5dYSqjWQvPTdF6ejW6ARjfVJUFwhZ4XHiyiH4WB3XAJUA4sKPDlkXMR R0VVdSAhy6xFs9MgnsMxYGYMmLX9hT4Yl/iUd25wOWR7c+2Ue6Mb9AvmpCjQJfWfB4E0 QS0LH56QV0sTF4G2+rDBtF8+aGux9gsXSxFZsy1etMYKF4PtcTJ/C0WFyBKOuNzF+3nR VVYQ== X-Gm-Message-State: AFeK/H0lzLyet4A2NecPt+OM96m+IJusaE2SCtb1LRpUuBdYxFG9LrnxSTbu1N8wlUed3Q== X-Received: by 10.55.67.66 with SMTP id q63mr9125796qka.49.1491090366350; Sat, 01 Apr 2017 16:46:06 -0700 (PDT) Received: from [10.16.10.6] ([66.55.144.182]) by smtp.gmail.com with ESMTPSA id i5sm6464272qtb.63.2017.04.01.16.46.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Apr 2017 16:46:05 -0700 (PDT) From: "George D. Plymale" X-Mailbutler-Tracking-Uuid: 0AFE1A6B-EF54-4D44-B7FA-9BBA67A6BFB2 Content-Type: multipart/alternative; boundary="Apple-Mail=_4165EFB4-366D-41B2-81E6-D5F0372A226B" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: bug#26161: 25.1; `eshell-exit-success-p' determines that Lisp commands are successful if they return non-nil Date: Sat, 1 Apr 2017 19:46:00 -0400 X-Mailbutler-Link-Tracking-Uuid: To: npostavs@users.sourceforge.net Message-Id: <801CBEDF-791F-4950-A8B1-F1EA346267BA@orbitalimpact.com> X-Mailer: Apple Mail (2.3273) X-Spam-Score: 1.8 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > So maybe `eshell/cd' should be changed to return t when it succeeds? That would only solve the problem for this particular command. It's worth noting that even doing things like, e.g., `$ .. && pwd' or `$ cat ~/.emacs && pwd' don't execute their latter halves because the functions that the former parts expand to return nil, even if they are in fact successful. Honestly, it'd probably be better off if `eshell-exit-success-p' just checked`eshell-last-command-status' and Eshell makes sure that erring commands always set that to non-zero (which I think is already covered by `eshell-trap-errors'). [...] Content analysis details: (1.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.5 RCVD_IN_SORBS_SPAM RBL: SORBS: sender is a spam source [209.85.220.170 listed in dnsbl.sorbs.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.220.170 listed in list.dnswl.org] 0.0 HTML_MESSAGE BODY: HTML included in message 1.3 HTML_IMAGE_ONLY_24 BODY: HTML: images with 2000-2400 bytes of words -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.170 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid 0.0 T_REMOTE_IMAGE Message contains an external image X-Debbugs-Envelope-To: 26161 Cc: 26161@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.8 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > So maybe `eshell/cd' should be changed to return t when it succeeds? That would only solve the problem for this particular command. It's worth noting that even doing things like, e.g., `$ .. && pwd' or `$ cat ~/.emacs && pwd' don't execute their latter halves because the functions that the former parts expand to return nil, even if they are in fact successful. Honestly, it'd probably be better off if `eshell-exit-success-p' just checked`eshell-last-command-status' and Eshell makes sure that erring commands always set that to non-zero (which I think is already covered by `eshell-trap-errors'). [...] Content analysis details: (1.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.5 RCVD_IN_SORBS_SPAM RBL: SORBS: sender is a spam source [209.85.220.170 listed in dnsbl.sorbs.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.220.170 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.170 listed in wl.mailspike.net] 0.0 HTML_MESSAGE BODY: HTML included in message 1.3 HTML_IMAGE_ONLY_24 BODY: HTML: images with 2000-2400 bytes of words -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid --Apple-Mail=_4165EFB4-366D-41B2-81E6-D5F0372A226B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > So maybe `eshell/cd' should be changed to return t when it succeeds? That would only solve the problem for this particular command. It's = worth noting that even doing things like, e.g., `$ .. && pwd' or `$ cat = ~/.emacs && pwd' don't execute their latter halves because the functions that the = former parts expand to return nil, even if they are in fact successful. = Honestly, it'd probably be better off if `eshell-exit-success-p' just checked`eshell-last-command-status' and Eshell makes sure that erring = commands always set that to non-zero (which I think is already covered by `eshell-trap-errors'). > AFAICT, when you cd to a non-existent directory it doesn't throw an > error, but I don't think that should be considered success. Yeah, `eshell/cd' actually is able to bypass something like `eshell-trap-errors' because it uses `cd' under the hood through this function invocation: `(eshell-printn result)' where `result' is `(cd newdir)'. See, `eshell-printn' just captures the result of its given object and prints that out. In some cases, that object is an error (like when you cd into a non-existent directory), but you can't really tell that because `eshell-printn' doesn't care about errors; it just prints out the object it's given. Functions that do this sort of thing may also exist aside from `eshell/cd', so I'm unsure what can be done about that. --Apple-Mail=_4165EFB4-366D-41B2-81E6-D5F0372A226B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

> So maybe `eshell/cd' should be = changed to return t when it succeeds?

That = would only solve the problem for this particular command. It's worth
noting that even doing things like, e.g., `$ .. && = pwd' or `$ cat ~/.emacs &&
pwd' don't execute = their latter halves because the functions that the former
parts expand to return nil, even if they are in fact = successful. Honestly,
it'd probably be better off if = `eshell-exit-success-p' just
checked`eshell-last-command-status' and Eshell makes sure = that erring commands
always set that to non-zero (which I = think is already covered by
`eshell-trap-errors').

> AFAICT, when you cd to a non-existent = directory it doesn't throw an
> error, but I don't = think that should be considered success.

Yeah, `eshell/cd' actually is able to bypass something = like
`eshell-trap-errors' because it uses `cd' under the = hood through this
function invocation: `(eshell-printn = result)' where `result' is `(cd
newdir)'. See, = `eshell-printn' just captures the result of its given
object= and prints that out. In some cases, that object is an error (like
when you cd into a non-existent directory), but you can't = really tell
that because `eshell-printn' doesn't care = about errors; it just prints
out the object it's given. = Functions that do this sort of thing may also
exist aside = from `eshell/cd', so I'm unsure what can be done about that.
3D""= --Apple-Mail=_4165EFB4-366D-41B2-81E6-D5F0372A226B-- From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 01 20:05:03 2017 Received: (at 26161) by debbugs.gnu.org; 2 Apr 2017 00:05:03 +0000 Received: from localhost ([127.0.0.1]:56115 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuT0x-0004X7-AF for submit@debbugs.gnu.org; Sat, 01 Apr 2017 20:05:03 -0400 Received: from mail-io0-f169.google.com ([209.85.223.169]:36690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuT0u-0004WY-UU for 26161@debbugs.gnu.org; Sat, 01 Apr 2017 20:05:01 -0400 Received: by mail-io0-f169.google.com with SMTP id l7so57953589ioe.3 for <26161@debbugs.gnu.org>; Sat, 01 Apr 2017 17:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=k9KC1a5g/7tSzCZOliuTh62cNI6f+8dijxycmb69XfA=; b=iIJLNrqQzSB0uW9icJhkM9DNXVt2e5/ctz3AvTni63YpThExat6QCx6NzmPq39CF6a XTm/MpFO29aG+3IiEXJX/u301B2A+CFLICa4FfYINNUmqhInlQ/ESVUeBpzQoytnKImK Ss7mfI6A8Pd/Ng4ZaUu8igFmsxvT7HMeUQHqKz0K3qNR558JOP1MttxHhBCJeu5kPhyf QrKBKFaZP9jUd2wxhkt1qVJXyvP2zYZ2O8kHuODNSfzsP5atBYUWnBrG9MHJbpPIZ1wU PYwtBEuTRFsI9CJu5WPC23Ug/HJoa/rYwdMV6dGSLkzRCCWNyllCRzypGwTkh2xpv35/ sYsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=k9KC1a5g/7tSzCZOliuTh62cNI6f+8dijxycmb69XfA=; b=fus4EAFHuVP/D2qupaG8DX519NpFGGcKA24iKmQj8Gz9BPFQa77naeQ/kdHy5Xa5YG VO2TNzaUZUNeLNlpWEGIRFxzLSuSiXhys7CabZJlLd7b9QBXd9vUPizho67OY1zjZaHn AQSQKKrDVBfEQpkUNBpMJ0I8ysvOBdVg+FphQeJLDQLTy35jaGtm+c7SLH47Pxlys0ST cyyEiT1jz6SuiRx7WQaIfeLQhs1oVBNnpz2xTT1eK6t0JUDgCLYHpo+jWsjlFPrsTS4e KZnAEIllNMkbnzMNPicxZkptr2JADHDte6+VPljcCXI/DagbUZWuL/XteKh9yjGUVEI9 VTsg== X-Gm-Message-State: AFeK/H3DnH5T3qMjIGFy/BXufMpl56XhvmmJZYgEe4nnhGkyNyNc4FHMm7bnJkqLYc9B7w== X-Received: by 10.107.157.146 with SMTP id g140mr10071098ioe.63.1491091495348; Sat, 01 Apr 2017 17:04:55 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id m77sm3606213ita.16.2017.04.01.17.04.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Apr 2017 17:04:54 -0700 (PDT) From: npostavs@users.sourceforge.net To: "George D. Plymale" Subject: Re: bug#26161: 25.1; `eshell-exit-success-p' determines that Lisp commands are successful if they return non-nil References: <7E4E5778-FFBF-4298-9DEF-0A60539999D5@orbitalimpact.com> <801CBEDF-791F-4950-A8B1-F1EA346267BA@orbitalimpact.com> Date: Sat, 01 Apr 2017 20:06:19 -0400 In-Reply-To: <801CBEDF-791F-4950-A8B1-F1EA346267BA@orbitalimpact.com> (George D. Plymale's message of "Sat, 1 Apr 2017 19:46:00 -0400") Message-ID: <87wpb3zn9g.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 26161 Cc: 26161@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) "George D. Plymale" writes: > it'd probably be better off if `eshell-exit-success-p' just > checked`eshell-last-command-status' and Eshell makes sure that erring commands > always set that to non-zero (which I think is already covered by > `eshell-trap-errors'). That makes sense to me. >> AFAICT, when you cd to a non-existent directory it doesn't throw an >> error, but I don't think that should be considered success. > > Yeah, `eshell/cd' actually is able to bypass something like > `eshell-trap-errors' because it uses `cd' under the hood through this > function invocation: `(eshell-printn result)' where `result' is `(cd > newdir)'. See, `eshell-printn' just captures the result of its given > object and prints that out. In some cases, that object is an error (like > when you cd into a non-existent directory), but you can't really tell > that because `eshell-printn' doesn't care about errors; it just prints > out the object it's given. Functions that do this sort of thing may also > exist aside from `eshell/cd', so I'm unsure what can be done about that. It looks like `eshell-exec-lisp' catches the error, so probably `eshell-last-command-status' could be set there. Patches welcome. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 11 15:48:21 2017 Received: (at 26161) by debbugs.gnu.org; 11 Apr 2017 19:48:21 +0000 Received: from localhost ([127.0.0.1]:43331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cy1m1-00026E-Cm for submit@debbugs.gnu.org; Tue, 11 Apr 2017 15:48:21 -0400 Received: from mail-qt0-f180.google.com ([209.85.216.180]:36077) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cy1lz-00025z-Iv for 26161@debbugs.gnu.org; Tue, 11 Apr 2017 15:48:20 -0400 Received: by mail-qt0-f180.google.com with SMTP id v3so6629500qtd.3 for <26161@debbugs.gnu.org>; Tue, 11 Apr 2017 12:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orbitalimpact.com; s=google; h=from:mime-version:subject:date:cc:to:message-id; bh=lzpD12+eUAuxAxQFmkFjI95H3FDLQhxYKcdq8TTBKA0=; b=ODpjkx8BdkXVm4Ie7rRDf+5v5NQHy4sI/6EPnxBgRynbaXUfW/LRFnGpdobFaC0q4x Lm5TrMs1DrOxCD3T02Cfl6v4QaOa1hqdnMe1I4hP3Lp8CPpCbevYYoTzx/rwtftRHEo3 iFoHLU4bnDgXmUrtU8a23IAOIBarRTr524c5s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:cc:to:message-id; bh=lzpD12+eUAuxAxQFmkFjI95H3FDLQhxYKcdq8TTBKA0=; b=oRIHSqGwWobi9GqMjjyLTjanc+DN7nn2ZQx2Ua4ylo7ML0q+kuufjtZV/4/n+7/IU+ eSzp1lEJZkp4kCxQw32xBqqxjRShFy7vYS0uxe+UxpDbVociXMPs5oVrJ9sgRKbovc9v P39tzOCnzPLPQT+OgVgJXehn/iJDMpRlSAWVCrFqIW8cAbOn+Jga0IAXBNzc3qezDizx 0YouuLDfboJHsdxiKlJXwBJQcGsd6ikCFMoFfz4bH2INkzrgBb9vbOASDuHnOl/Y2T6+ gfK4iyE0rJNsgKtOT7TA/rv2HsnCObTRPdB3YuTvJN80pVRS229z+wua94RrjjIsRxSu K/Bg== X-Gm-Message-State: AN3rC/7jqsgNuBh2o/Q0Ra8U0WiNeV8n3JQpC/0UoqLJsom1Kx8oT1qCHNLZDptkYz8J4w== X-Received: by 10.200.56.175 with SMTP id f44mr15231902qtc.161.1491940093818; Tue, 11 Apr 2017 12:48:13 -0700 (PDT) Received: from [10.54.10.6] ([208.167.254.13]) by smtp.gmail.com with ESMTPSA id c26sm7057722qte.19.2017.04.11.12.48.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 12:48:12 -0700 (PDT) From: "George D. Plymale" X-Mailbutler-Tracking-Uuid: 406B8614-AE3B-4088-9C5B-6F43723FD10C Content-Type: multipart/alternative; boundary="Apple-Mail=_3411E699-159D-43B2-8DC5-304537904803" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: bug#26161: 25.1; `eshell-exit-success-p' determines that Lisp commands are successful if they return non-nil Date: Tue, 11 Apr 2017 15:48:05 -0400 X-Mailbutler-Link-Tracking-Uuid: To: npostavs@users.sourceforge.net Message-Id: <446FF585-0B21-4774-8966-DCECB218C96B@orbitalimpact.com> X-Mailer: Apple Mail (2.3273) X-Spam-Score: -0.2 (/) X-Debbugs-Envelope-To: 26161 Cc: 26161@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) --Apple-Mail=_3411E699-159D-43B2-8DC5-304537904803 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=bug_26161_fix.diff Content-Description: Fix for bug#26161 diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index 583ba6ac42..86e7b83c28 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -575,14 +575,9 @@ eshell-rewrite-if-command (defvar eshell-last-command-result) ;Defined in esh-io.el. (defun eshell-exit-success-p () - "Return non-nil if the last command was \"successful\". -For a bit of Lisp code, this means a return value of non-nil. -For an external command, it means an exit code of 0." - (if (save-match-data - (string-match "#<\\(Lisp object\\|function .*\\)>" - eshell-last-command-name)) - eshell-last-command-result - (= eshell-last-command-status 0))) + "Return non-nil if the last command was successful. +This means an exit code of 0." + (= eshell-last-command-status 0)) (defvar eshell--cmd) @@ -1257,6 +1252,7 @@ eshell-exec-lisp (and result (funcall printer result)) result) (error + (setq eshell-last-command-status 1) (let ((msg (error-message-string err))) (if (and (not form-p) (string-match "^Wrong number of arguments" msg) --=-=-= Content-Type: text/plain Okay, so I created a patch to fix this issue. Go easy on me since this is my first patch to Emacs ;) The changes are pretty simple: - `eshell-exit-success-p' has been changed to only check if the last exit code was zero, rather than first checking whether the last command returned nil. - `eshell-exec-lisp' has been changed so that it will set `eshell-last-command-status' to 1 if it catches an error. - These changes together make it so that the `&&' operator in Eshell behaves more expectedly to someone who has used a bash-like shell and so that other things involving the success of Lisp commands in Eshell are more reliable. Feel free to point out anything else that should be done here or any errors on my part. I have tested these changes out and everything seems okay. I can run the aforementioned commands that were problematic. Examples: ~ $ cd .. && pwd /Users /Users $ cd - && pwd /Users/my_username ~ $ .. && pwd /Users /Users $ cd - && pwd /Users/my_username ~ $ cat ~/.emacs && pwd ;; Emacs init file stuff (foo bar)/Users/my_username ~ $ cat nowhere && pwd cat: nowhere: No such file or directory ~ $ cat nowhere ; pwd cat: nowhere: No such file or directory /Users/my_username ~ $ --=-=-=-- --Apple-Mail=_3411E699-159D-43B2-8DC5-304537904803 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
--=3D-=3D-=3D
Content-Type: text/x-patch
Content-Disposition: attachment; = filename=3Dbug_26161_fix.diff
Content-Description: Fix for = bug#26161

diff --git = a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index = 583ba6ac42..86e7b83c28 100644
--- = a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -575,14 +575,9 @@ eshell-rewrite-if-command
= (defvar eshell-last-command-result)     ;Defined = in esh-io.el.

(defun = eshell-exit-success-p ()
-  "Return non-nil if the = last command was \"successful\".
-For a bit of Lisp code, = this means a return value of non-nil.
-For an external = command, it means an exit code of 0."
-  (if (save-match-data
- = (string-match "#<\\(Lisp object\\|function .*\\)>"
- = =       = eshell-last-command-name))
-      = eshell-last-command-result
-    (=3D = eshell-last-command-status 0)))
+  "Return non-nil if the = last command was successful.
+This means an exit code of = 0."
+  = (=3D eshell-last-command-status 0))

= (defvar eshell--cmd)

@@ -1257,6 +1252,7 @@ = eshell-exec-lisp
       =   (and result (funcall printer result))
       =   result)
     = (error
+     (setq = eshell-last-command-status 1)
      = (let ((msg (error-message-string err)))
       = (if (and (not form-p)
       =           = (string-match "^Wrong number of arguments" msg)

--=3D-=3D-=3D
Content-Type: text/plain

Okay, so I created a patch to fix this issue. = Go easy on me since this
is my first patch to Emacs ;)

The changes are pretty simple:
- `eshell-exit-success-p' has been changed to only check if = the last
 = exit code was zero, rather than first checking whether the last = command
  = returned nil.
- `eshell-exec-lisp' has been changed so = that it will set
  = `eshell-last-command-status' to 1 if it catches an error.
- = These changes together make it so that the `&&' operator in = Eshell
  = behaves more expectedly to someone who has used a bash-like shell and
  so that = other things involving the success of Lisp commands in Eshell
  are more = reliable.
 
Feel free = to point out anything else that should be done here or any
errors on my part. I have tested these changes out and = everything seems
okay. I can run the aforementioned = commands that were problematic. Examples:

~ = $ cd .. && pwd
/Users

/Users $ cd - && pwd
/Users/my_username

~ $ .. = && pwd
/Users

/Users = $ cd - && pwd
/Users/my_username

~ $ cat ~/.emacs && pwd
;; Emacs init = file stuff
(foo bar)/Users/my_username

~ $ cat nowhere && pwd
cat: nowhere: No = such file or directory

~ $ cat nowhere ; = pwd
cat: nowhere: No such file or directory
/Users/my_username

~ $

--=3D-=3D-=3D--



3D""= --Apple-Mail=_3411E699-159D-43B2-8DC5-304537904803-- From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 12 21:17:04 2017 Received: (at 26161) by debbugs.gnu.org; 13 Apr 2017 01:17:04 +0000 Received: from localhost ([127.0.0.1]:44880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cyTNg-0003QP-IJ for submit@debbugs.gnu.org; Wed, 12 Apr 2017 21:17:04 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:35869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cyTNe-0003Pn-MX; Wed, 12 Apr 2017 21:17:02 -0400 Received: by mail-io0-f196.google.com with SMTP id x86so10169946ioe.3; Wed, 12 Apr 2017 18:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=eGwtc5DcwOoa6XhMCe2haGY/9PF+yYTEthQNhUxYTlE=; b=KsuS0RqF82ErM7k4hnAgwjYoRtbXY/Gw32C7l0DZ8gR2ciJNCqQAljAml0jkWzj5bA suz3jiJ3pNtWMpW5Y2SxvxPmDnPEKdayvsH1yVTOJUGVaViEyHG0+D7u1UHUHBYV73jP 0/ENskbuuJK+DlHFhA7c0MVycx8/g6wPQHo9y4BikxZUyf/bVo/MDwE8tA5EAkU7qicZ GPpH/eJoROu229U9uetArUM1bNCzl1ZS7zDN7HD4L8zo7dkxQcZ5MSieyPAeMvv/68tr AWLmzWdJryoKAM6GJG7ipN4JwbVqjnkezpjXAHCWbmNj5Dmh1YcCeojzgfMTiRgJm/zx SztA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=eGwtc5DcwOoa6XhMCe2haGY/9PF+yYTEthQNhUxYTlE=; b=RqGGnFUVFozrcAnIjx7U7MNipwJtYnAgLZdS9R0/5JMF/vd82BodAz/ufk8LlQYW2H SoCpAT1vdiACvAoq8Muncal0TUj7n45NSFKOzrcUg0U/Fy0lIg316f0vq/aLkwQI8U7p eEKkAjk65j5pxoCjGOMh5udxkUN+n9BiE4fMhhMhDhvfjdtno5PvLK3/4Ei8gZPjmZ9q T8/ZuJC2G2Q9Lv484nAdJM3uArzeS7PTFEnauCYiHwIWYw1jPgsDGBPmXpWyCcM0RCea HLlg5HI5mwHsKqG6J97CJa91FrtSgTTeGQsU/qArYi+kuDkvrhits3Vnr8wfeMw9slN5 Lo6g== X-Gm-Message-State: AN3rC/4wGvZZRpJFagivR/maT/V4mF2ii2NLCR8AMyssOVOOdGaNtEcF id8ewLORHT0shQ== X-Received: by 10.107.19.224 with SMTP id 93mr1026775iot.188.1492046217096; Wed, 12 Apr 2017 18:16:57 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id 9sm3260455itm.6.2017.04.12.18.16.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Apr 2017 18:16:56 -0700 (PDT) From: npostavs@users.sourceforge.net To: "George D. Plymale" Subject: Re: bug#26161: 25.1; `eshell-exit-success-p' determines that Lisp commands are successful if they return non-nil References: <7E4E5778-FFBF-4298-9DEF-0A60539999D5@orbitalimpact.com> <446FF585-0B21-4774-8966-DCECB218C96B@orbitalimpact.com> Date: Wed, 12 Apr 2017 21:18:25 -0400 In-Reply-To: <446FF585-0B21-4774-8966-DCECB218C96B@orbitalimpact.com> (George D. Plymale's message of "Tue, 11 Apr 2017 15:48:05 -0400") Message-ID: <877f2pt89q.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 26161 Cc: 26161@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) tags 26161 patch quit "George D. Plymale" writes: > Feel free to point out anything else that should be done here or any > errors on my part. I have tested these changes out and everything seems > okay. Looks good, could you try adding a commit message as decribed in CONTRIBUTE, and then 'git format-patch' will produce the patch along with the message. From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 20 15:48:30 2017 Received: (at 26161) by debbugs.gnu.org; 20 Apr 2017 19:48:30 +0000 Received: from localhost ([127.0.0.1]:59371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1I45-0007IG-FI for submit@debbugs.gnu.org; Thu, 20 Apr 2017 15:48:30 -0400 Received: from mail-qk0-f181.google.com ([209.85.220.181]:35365) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1I43-0007I3-HX for 26161@debbugs.gnu.org; Thu, 20 Apr 2017 15:48:27 -0400 Received: by mail-qk0-f181.google.com with SMTP id f133so56039474qke.2 for <26161@debbugs.gnu.org>; Thu, 20 Apr 2017 12:48:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orbitalimpact.com; s=google; h=from:to:cc:subject:in-reply-to:date:message-id:mime-version; bh=iMsGcg7YaWi6W8VkXvw6aymZ4jp/7P0YgJe1N/E+WeM=; b=JWzLevWuIeMv2MiqRXaXidkly2EkQoNaevd85Qx4jVMqzF+GnkLYpFfXmxor2ofCu8 MuZnd1J8M7P8cnIk1vmORpJ+i2TavMiD8hjqJNlUK9vmy8WsE2sZuDYbR7TE0POoltdU DYgihc8FHabfAmp9UfyUCeJcArek5TbcxUQO0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:date:message-id :mime-version; bh=iMsGcg7YaWi6W8VkXvw6aymZ4jp/7P0YgJe1N/E+WeM=; b=DV9F/tU9xGzXs2eJC31oLtLwiH1FNJ/y3Oy7giyoRsKX8M+j3JFm256Zguo1UDXfHE PP/OoMQuBtqpF7FEiuKGCJrW7aCJpsPa+/xQqrqbxN5pZaMxmuxI3s84xa7DQ6WvvbpV BcSNADPOfvsF2r1soVc3r0DhhA6pf4KWhdovCvQ14Tjxay6ujZEZ0tihFIsn1ruzeFGB CN1xiuGYBWsGHIv2c7fCOfl5j3VrIzlhC71U1I+Gk7BAotjMioLg1zGym5MVfOPuv0tN cbekQsasLrTaDYHnS+P/+XnVQ6kQHhw7f/k87NkcL6ojzQ7oXvO7ZfUouszrZPHXPuln qNPQ== X-Gm-Message-State: AN3rC/6VPQdpE0UmXsCepEhC7TVnUM4cVo63Iucd3ae6faQo0vL7IBEy f+WqZsuW0dJZxA== X-Received: by 10.55.124.66 with SMTP id x63mr8901098qkc.225.1492717701957; Thu, 20 Apr 2017 12:48:21 -0700 (PDT) Received: from lehi.dev.orbitalimpact.com ([208.167.254.70]) by smtp.gmail.com with ESMTPSA id i16sm4808872qta.61.2017.04.20.12.48.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Apr 2017 12:48:20 -0700 (PDT) From: George Plymale II To: npostavs@users.sourceforge.net Subject: Re: bug#26161: 25.1; `eshell-exit-success-p' determines that Lisp commands are successful if they return non-nil In-Reply-To: <877f2pt89q.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Date: Thu, 20 Apr 2017 15:47:45 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 26161 Cc: 26161@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-for-bug-26161.patch Content-Description: Patch >From ed579eaaaaf4fd6a0b78a8c52a897eaa5cb322de Mon Sep 17 00:00:00 2001 From: "George D. Plymale II" Date: Thu, 20 Apr 2017 14:05:11 -0400 Subject: [PATCH] Fix for bug#26161 * `eshell-exit-success-p' has been changed to only check if the last exit code was zero, rather than first checking whether the last command returned nil. * `eshell-exec-lisp' has been changed so that it will set `eshell-last-command-status' to 1 if it catches an error. * These changes together make it so that the `&&' operator in Eshell behaves more expectedly to someone who has used a bash-like shell and so that other things involving the success of Lisp commands in Eshell are more reliable. --- lisp/eshell/esh-cmd.el | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index d3613d3140..53a266d149 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -575,14 +575,9 @@ eshell-rewrite-if-command (defvar eshell-last-command-result) ;Defined in esh-io.el. (defun eshell-exit-success-p () - "Return non-nil if the last command was \"successful\". -For a bit of Lisp code, this means a return value of non-nil. -For an external command, it means an exit code of 0." - (if (save-match-data - (string-match "#<\\(Lisp object\\|function .*\\)>" - eshell-last-command-name)) - eshell-last-command-result - (= eshell-last-command-status 0))) + "Return non-nil if the last command was successful. +This means an exit code of 0." + (= eshell-last-command-status 0)) (defvar eshell--cmd) @@ -1257,6 +1252,7 @@ eshell-exec-lisp (and result (funcall printer result)) result) (error + (setq eshell-last-command-status 1) (let ((msg (error-message-string err))) (if (and (not form-p) (string-match "^Wrong number of arguments" msg) -- 2.11.0 (Apple Git-81) --=-=-= Content-Type: text/plain Thanks for the advice. Apologies for the crappy formatting on my last message. I think my system mail client and my Emacs mail client had a disagreement and it ended up looking like that. So now I'm sending this directly via the Emacs mail client (hopefully it doesn't screw stuff up either). The requested patch is attached now to this message, so please let me know if you need anything else. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 20 23:09:36 2017 Received: (at 26161) by debbugs.gnu.org; 21 Apr 2017 03:09:36 +0000 Received: from localhost ([127.0.0.1]:59564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1Owy-0002dJ-JG for submit@debbugs.gnu.org; Thu, 20 Apr 2017 23:09:36 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:35301) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1Owr-0002cn-QH; Thu, 20 Apr 2017 23:09:30 -0400 Received: by mail-io0-f195.google.com with SMTP id d203so24708836iof.2; Thu, 20 Apr 2017 20:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=qMe6QcTTIy+AIKKg7B6vbJSr/AdL/JINndygIy3NqGQ=; b=kUTYbAXmqitXLSDUIrZhCia0yOMdOVM604VFzWgNzvqILAyXAtiF+UEbFpfCJD0kN6 TK48B3g9Ud5h2L9ZiyVV7INgTvED7p6/xPRZ582yICGz7ZeYuolWWlprk8xIwNwoXvNM 5RXuHLtTgabFo7xg63OXlCHUybcFbDz8TCPg99c3XK+ncH5wHMyWQQv1Agc0rHXa5y14 qP8KimXsibQmEW4j/+OhCWk2doWBR+MwrnX9JiPgyZd0OZsqknT+qZzev8bwPrPxwxvO 3qbyWrHdtpwjtthtoWQY2nXlh+22rqkuz7FK8mKzJJRuBA2//FbgVKsLp6Vr4lIP7dz6 GX8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=qMe6QcTTIy+AIKKg7B6vbJSr/AdL/JINndygIy3NqGQ=; b=CEiWkqj2JQMGZkDl2AlYNyEE69Wv7oyLkM311KkfjTl5mZhpo6EqeIk1VH6eFpYdeZ Va53pyXHnt8WJ+vQx7FW9dq8l/MY9AI2A0H5DZD5nuXPp7nKLJ26IgW4FdQ9nU4U3QYq qCedQEc6MVOPyqL0ZLr9le3lNG0G81DdkwWuMT0+em95cSIpJtYdTc5jmqThDYCg3Co/ OfTA82QrwVXrr5X2Y4gc2DHGjiumlxrCBjyHUnxYENmLNrW3U2PVpiOnrEfiS7aONsI8 gI7qfzbxnAKCtF04UlpptZ9MWnnyYX5eKs6hyXoLHf2jeAMNzrldD//xIiNXdfXZTaB6 yhIA== X-Gm-Message-State: AN3rC/4d/5P+bYJC12FMjK70lcXR1LkPh6WFbAXicS3c2jH8jJqCzhLB DyWsYxMGumvFea4m X-Received: by 10.36.219.195 with SMTP id c186mr7832435itg.25.1492744163841; Thu, 20 Apr 2017 20:09:23 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id h42sm3598151ioi.16.2017.04.20.20.09.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Apr 2017 20:09:22 -0700 (PDT) From: npostavs@users.sourceforge.net To: George Plymale II Subject: Re: bug#26161: 25.1; `eshell-exit-success-p' determines that Lisp commands are successful if they return non-nil References: <7E4E5778-FFBF-4298-9DEF-0A60539999D5@orbitalimpact.com> Date: Thu, 20 Apr 2017 23:10:52 -0400 In-Reply-To: (George Plymale, II's message of "Thu, 20 Apr 2017 15:47:45 -0400") Message-ID: <87k26eqwub.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 26161 Cc: 26161@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) tags 26161 fixed close 26161 26.1 quit George Plymale II writes: > Thanks for the advice. Apologies for the crappy formatting on my last > message. I think my system mail client and my Emacs mail client had a > disagreement and it ended up looking like that. It looked a bit funny, but there was no line wrapping so it didn't do any harm. > So now I'm sending this > directly via the Emacs mail client (hopefully it doesn't screw stuff up > either). The requested patch is attached now to this message, so please > let me know if you need anything else. Thanks, pushed to master [1: e8875bcbe0]. I reformatted your commit message to conform to the ChangeLog format and marked this as a copyright exempt change. 1: 2017-04-20 23:03:10 -0400 Treat non-erroring lisp call as successful eshell command (Bug#26161) http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=e8875bcbe067ea020dba95530ec4e9485942babd From unknown Sat Jun 21 03:08:11 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 19 May 2017 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator