From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#9226: 23.3; [rgrep]; (matches found) ? Date: Wed, 10 Aug 2011 18:10:27 +0300 Organization: JURTA Message-ID: <87pqkdwblb.fsf@mail.jurta.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1312989194 11133 80.91.229.12 (10 Aug 2011 15:13:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 10 Aug 2011 15:13:14 +0000 (UTC) Cc: Dave Abrahams , 9226@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 10 17:13:09 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QrASy-0005Px-6E for geb-bug-gnu-emacs@m.gmane.org; Wed, 10 Aug 2011 17:13:08 +0200 Original-Received: from localhost ([::1]:49346 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrASu-0006lN-Mr for geb-bug-gnu-emacs@m.gmane.org; Wed, 10 Aug 2011 11:13:04 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:50274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrASg-0006AA-Q0 for bug-gnu-emacs@gnu.org; Wed, 10 Aug 2011 11:12:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QrASf-00063Q-EU for bug-gnu-emacs@gnu.org; Wed, 10 Aug 2011 11:12:50 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56039) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrASf-00063M-9j for bug-gnu-emacs@gnu.org; Wed, 10 Aug 2011 11:12:49 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QrATq-0006RF-Pn; Wed, 10 Aug 2011 11:14:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Aug 2011 15:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9226 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9226-submit@debbugs.gnu.org id=B9226.131298923124727 (code B ref 9226); Wed, 10 Aug 2011 15:14:02 +0000 Original-Received: (at 9226) by debbugs.gnu.org; 10 Aug 2011 15:13:51 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QrATb-0006Qi-6Q for submit@debbugs.gnu.org; Wed, 10 Aug 2011 11:13:49 -0400 Original-Received: from smarty.dreamhost.com ([208.113.175.8]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QrATO-0006QQ-DA for 9226@debbugs.gnu.org; Wed, 10 Aug 2011 11:13:45 -0400 Original-Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id 923E16E807D; Wed, 10 Aug 2011 08:11:32 -0700 (PDT) Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 8984B451C2AA; Wed, 10 Aug 2011 08:11:30 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Wed, 10 Aug 2011 09:35:55 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 10 Aug 2011 11:14:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:49985 Archived-At: > I suggest we remove this "matches found" thingy. It was meant to be > a feature, but in the case where it works (i.e. for `grep') the rest of > the output already gives the information anyway. > > We can replace it with the exit status code instead: it's more cryptic > but at least it never lies. It would be too bad to lose this useful feature that helps to quickly see the status in the last line of the output and in the mode line. What we definitely know now is that: GREP EXIT STATUS The exit status is 0 if selected lines are found, and 1 if not found. If an error occurred the exit status is 2. (Note: POSIX error handling code should check for '2' or greater.) FIND EXIT STATUS find exits with status 0 if all files are processed successfully, greater than 0 if errors occur. This is deliberately a very broad description, but if the return value is non-zero, you should not rely on the correctness of the results of find. XARGS EXIT STATUS 0 if it succeeds 123 if any invocation of the command exited with status 1-125 124 if the command exited with status 255 125 if the command is killed by a signal 126 if the command cannot be run 127 if the command is not found 1 if some other error occurred. and currently process the following cases in grep.el: 0 finished (matches found) 1 finished with no matches found * exited abnormally with code %d So to never lie to the users and determine reliably the status we could use the following logic: If status is 0 and the output is not empty: Grep finished (matches found) Otherwise: Grep exited with status %d These changes completely remove the case of status 1 that displayed "finished with no matches found", and also remove the word "abnormally" from the message of remaining cases, because we can't reliably determine the case of "no matches found" by checking status 123 of a command line that contains "xargs".