From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.bugs Subject: bug#32093: 27.0.50; M-x grep appends /dev/null to command line Date: Sun, 08 Jul 2018 13:17:53 +0200 Message-ID: <87d0vydli6.fsf@fencepost.gnu.org> References: <87lgamdqcb.fsf@fencepost.gnu.org> <87pnzyawdg.fsf@gmx.de> <87h8ladpem.fsf@fencepost.gnu.org> <87lgamavq7.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1531048627 17847 195.159.176.226 (8 Jul 2018 11:17:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Jul 2018 11:17:07 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 32093@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 08 13:17:02 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fc7gc-0004XT-AA for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Jul 2018 13:17:02 +0200 Original-Received: from localhost ([::1]:36600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fc7ij-0001iE-AV for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Jul 2018 07:19:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fc7ic-0001i3-Cl for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 07:19:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fc7iY-0007AR-DT for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 07:19:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42800) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fc7iY-0007AE-9B for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 07:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fc7iY-0001PA-0S for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 07:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Kastrup Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jul 2018 11:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32093 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32093-submit@debbugs.gnu.org id=B32093.15310486885334 (code B ref 32093); Sun, 08 Jul 2018 11:19:01 +0000 Original-Received: (at 32093) by debbugs.gnu.org; 8 Jul 2018 11:18:08 +0000 Original-Received: from localhost ([127.0.0.1]:50697 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fc7hg-0001Ny-7u for submit@debbugs.gnu.org; Sun, 08 Jul 2018 07:18:08 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49827) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fc7he-0001NT-AA for 32093@debbugs.gnu.org; Sun, 08 Jul 2018 07:18:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fc7hV-0006o1-2f for 32093@debbugs.gnu.org; Sun, 08 Jul 2018 07:18:01 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fc7hU-0006ns-UJ; Sun, 08 Jul 2018 07:17:56 -0400 Original-Received: from x4db54f11.dyn.telefonica.de ([77.181.79.17]:54906 helo=lola) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fc7hT-0005ML-W4; Sun, 08 Jul 2018 07:17:56 -0400 In-Reply-To: <87lgamavq7.fsf@gmx.de> (Michael Albinus's message of "Sun, 08 Jul 2018 12:05:20 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:148336 Archived-At: Michael Albinus writes: > David Kastrup writes: > >> So you are saying there is a bug workaround that will tie me into using >> one grep-like command in future, ever. Because obviously in my case >> auto detection failed. > > Don't know. Maybe you check what autodetect does in your case. Here is the respective code: 318e2976570 (Kim F. Storm 2003-11-23 626) (unless (or (not grep-use-null-device) (eq grep-use-null-device t)) 318e2976570 (Kim F. Storm 2003-11-23 627) (setq grep-use-null-device 318e2976570 (Kim F. Storm 2003-11-23 628) (with-temp-buffer 318e2976570 (Kim F. Storm 2003-11-23 629) (let ((hello-file (expand-file-name "HELLO" data-directory))) 318e2976570 (Kim F. Storm 2003-11-23 630) (not 0acfb7cea68 (Kim F. Storm 2006-04-28 631) (and (if grep-command 318e2976570 (Kim F. Storm 2003-11-23 632) ;; `grep-command' is already set, so 318e2976570 (Kim F. Storm 2003-11-23 633) ;; use that for testing. 0acfb7cea68 (Kim F. Storm 2006-04-28 634) (grep-probe grep-command 0acfb7cea68 (Kim F. Storm 2006-04-28 635) `(nil t nil "^English" ,hello-file) 0acfb7cea68 (Kim F. Storm 2006-04-28 636) #'call-process-shell-command) 318e2976570 (Kim F. Storm 2003-11-23 637) ;; otherwise use `grep-program' 0acfb7cea68 (Kim F. Storm 2006-04-28 638) (grep-probe grep-program 0acfb7cea68 (Kim F. Storm 2006-04-28 639) `(nil t nil "-nH" "^English" ,hello-file))) 318e2976570 (Kim F. Storm 2003-11-23 640) (progn 318e2976570 (Kim F. Storm 2003-11-23 641) (goto-char (point-min)) 318e2976570 (Kim F. Storm 2003-11-23 642) (looking-at 318e2976570 (Kim F. Storm 2003-11-23 643) (concat (regexp-quote hello-file) 318e2976570 (Kim F. Storm 2003-11-23 644) ":[0-9]+:English"))))))))) So the procedure is that the proposed command line (taken from grep-program) does not include -nH . User edits it to turn it into "git grep". Autodetection tries calling this(?) on the hello-file(?) which fails due to the hello-file not being in the Git repository. As a result, Emacs decides to use /dev/null (?). This code actually is considerably old, older than what I remember having worked (though it's sort of hard to tell since the results of autodetection are stored in a session). So I consider it more likely that the more recent 644cdd1aa0a (Noam Postavsky 2016-09-13 646) (when (eq grep-use-null-filename-separator 'auto-detect) 644cdd1aa0a (Noam Postavsky 2016-09-13 647) (setq grep-use-null-filename-separator 644cdd1aa0a (Noam Postavsky 2016-09-13 648) (with-temp-buffer 644cdd1aa0a (Noam Postavsky 2016-09-13 649) (let* ((hello-file (expand-file-name "HELLO" data-directory)) 644cdd1aa0a (Noam Postavsky 2016-09-13 650) (args `("--null" "-ne" "^English" ,hello-file))) 644cdd1aa0a (Noam Postavsky 2016-09-13 651) (if grep-use-null-device 644cdd1aa0a (Noam Postavsky 2016-09-13 652) (setq args (append args (list null-device))) 644cdd1aa0a (Noam Postavsky 2016-09-13 653) (push "-H" args)) 644cdd1aa0a (Noam Postavsky 2016-09-13 654) (and (grep-probe grep-program `(nil t nil ,@args)) 644cdd1aa0a (Noam Postavsky 2016-09-13 655) (progn 644cdd1aa0a (Noam Postavsky 2016-09-13 656) (goto-char (point-min)) 644cdd1aa0a (Noam Postavsky 2016-09-13 657) (looking-at 644cdd1aa0a (Noam Postavsky 2016-09-13 658) (concat (regexp-quote hello-file) 644cdd1aa0a (Noam Postavsky 2016-09-13 659) "\0[0-9]+:English")))))))) 644cdd1aa0a (Noam Postavsky 2016-09-13 660) is involved here. At any rate, the principal problem here is that "git grep" is a grep-like command that will usually refuse to work on out-of-tree files (unless --no-index option is given). So the results from any of the autodetection, based on searching the HELLO file, are sort-of random. -- David Kastrup