From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#43055: 27.1; [PATCH] * lisp/term.el: Use correct exit status in suggested dir-tracking functions Date: Wed, 26 Aug 2020 15:58:39 +1200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_f586529d421c926f0539a8478c23db33" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35612"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Orcon Webmail To: 43055@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 26 05:59:09 2020 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 1kAmab-00097J-NY for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Aug 2020 05:59:09 +0200 Original-Received: from localhost ([::1]:38064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAmaa-0002Af-9T for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Aug 2020 23:59:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAmaU-0002AZ-56 for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 23:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53677) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kAmaT-0008He-RB for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 23:59:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kAmaT-0002SJ-QJ for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 23:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Aug 2020 03:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43055 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.15984143319416 (code B ref -1); Wed, 26 Aug 2020 03:59:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Aug 2020 03:58:51 +0000 Original-Received: from localhost ([127.0.0.1]:36990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAmaI-0002Ro-T5 for submit@debbugs.gnu.org; Tue, 25 Aug 2020 23:58:51 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAmaG-0002Rg-HG for submit@debbugs.gnu.org; Tue, 25 Aug 2020 23:58:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAmaG-0002AO-89 for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 23:58:48 -0400 Original-Received: from smtp-1.orcon.net.nz ([60.234.4.34]:60207) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAmaE-0008FS-Dq for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 23:58:47 -0400 Original-Received: from [10.253.37.70] (port=13231 helo=webmail.orcon.net.nz) by smtp-1.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1kAma7-0004vT-FO for bug-gnu-emacs@gnu.org; Wed, 26 Aug 2020 15:58:39 +1200 Original-Received: from wlgwil-nat-office.catalyst.net.nz ([202.78.240.7]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 26 Aug 2020 15:58:39 +1200 X-Sender: psainty@orcon.net.nz X-GeoIP: -- Received-SPF: pass client-ip=60.234.4.34; envelope-from=psainty@orcon.net.nz; helo=smtp-1.orcon.net.nz X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/25 23:58:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:186393 Archived-At: --=_f586529d421c926f0539a8478c23db33 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed The shell function overrides suggested in term.el to facilitate directory tracking cause those commands to return a success status unconditionally: cd() { command cd "$@"; printf '\033AnSiTc %s\n' "$PWD"; } pushd() { command pushd "$@"; printf '\033AnSiTc %s\n' "$PWD"; } popd() { command popd "$@"; printf '\033AnSiTc %s\n' "$PWD"; } I.e. if the 'cd' fails, we are ignoring that and instead returning the 'printf' exit status. I believe these should be: cd() { command cd "$@" && printf '\033AnSiTc %s\n' "$PWD"; } pushd() { command pushd "$@" && printf '\033AnSiTc %s\n' "$PWD"; } popd() { command popd "$@" && printf '\033AnSiTc %s\n' "$PWD"; } If the command fails, no dir-tracking update should be needed in Emacs (so it's fine not to do that part), and we will see the exit status for the original command, so I think this is all that's required. Patch attached. -Phil --=_f586529d421c926f0539a8478c23db33 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=0001-lisp-term.el-Use-correct-exit-status-in-suggested-di.patch Content-Disposition: attachment; filename=0001-lisp-term.el-Use-correct-exit-status-in-suggested-di.patch; size=1073 RnJvbSBkNWU0YTZmYjUzMzE1NjIxZWQxNjE5ODZkOWQwMWMzYzJiYjc0MzU3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBQaGlsIFNhaW50eSA8cHNhaW50eUBvcmNvbi5uZXQubno+CkRh dGU6IFdlZCwgMjYgQXVnIDIwMjAgMTU6NDA6MzMgKzEyMDAKU3ViamVjdDogW1BBVENIXSAqIGxp c3AvdGVybS5lbDogVXNlIGNvcnJlY3QgZXhpdCBzdGF0dXMgaW4gc3VnZ2VzdGVkCiBkaXItdHJh Y2tpbmcgZnVuY3Rpb25zCgotLS0KIGxpc3AvdGVybS5lbCB8IDYgKysrLS0tCiAxIGZpbGUgY2hh bmdlZCwgMyBpbnNlcnRpb25zKCspLCAzIGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL2xpc3Av dGVybS5lbCBiL2xpc3AvdGVybS5lbAppbmRleCAwOWRmZWI2MWQxLi40MDFlZTdkODU5IDEwMDY0 NAotLS0gYS9saXNwL3Rlcm0uZWwKKysrIGIvbGlzcC90ZXJtLmVsCkBAIC0yNDEsOSArMjQxLDkg QEAKIDs7CQlwcmludGYgJ1wwMzNBblNpVHUgJXNcbicgIiRVU0VSIgogOzsJCXByaW50ZiAnXDAz M0FuU2lUYyAlc1xuJyAiJFBXRCIKIDs7Ci07Ow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