Subject: bug#32093: 27.0.50; M-x grep appends /dev/null to command line

From: Noam Postavsky <[email-masked]>
Date: Mon, 09 Jul 2018 17:43:46 -0400

Eli Zaretskii <[email-masked]> writes:

> But is there a good reason why we use HELLO for that?  Why not README,
> say, whose first line will always start with "Copyright"?

I don't think there's a reason to use HELLO in particular.  etc/README
doesn't have Copyright on the first line, but it does have COPYRIGHT at
the beginning of a line (I think we do want something specifically in
etc/, because we know `data-directory' tells us where to find it).

>From 3b0f302b7d06c37cc6fbff2f1e18904020de51f2 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <[email-masked]>
Date: Mon, 9 Jul 2018 17:38:40 -0400
Subject: [PATCH v1] Use README instead of HELLO for grep probing (Bug#32093)

* lisp/progmodes/grep.el (grep-compute-defaults): Check README for the
string COPYRIGHT; HELLO no longer has "English" at the beginning of a
line since 2018-05-19 "Use Enriched mode in etc/HELLO to keep charset
information".
---
 lisp/progmodes/grep.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index b7c44d6083..b466e205b8 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -626,28 +626,28 @@ grep-compute-defaults
     (unless (or (not grep-use-null-device) (eq grep-use-null-device t))
       (setq grep-use-null-device
 	    (with-temp-buffer
-	      (let ((hello-file (expand-file-name "HELLO" data-directory)))
+	      (let ((hello-file (expand-file-name "README" data-directory)))
 		(not
 		 (and (if grep-command
 			  ;; `grep-command' is already set, so
 			  ;; use that for testing.
 			  (grep-probe grep-command
-				      `(nil t nil "^English" ,hello-file)
+				      `(nil t nil "^COPYRIGHT" ,hello-file)
 				      #'call-process-shell-command)
 			;; otherwise use `grep-program'
 			(grep-probe grep-program
-				    `(nil t nil "-nH" "^English" ,hello-file)))
+				    `(nil t nil "-nH" "^COPYRIGHT" ,hello-file)))
 		      (progn
 			(goto-char (point-min))
 			(looking-at
 			 (concat (regexp-quote hello-file)
-				 ":[0-9]+:English")))))))))
+				 ":[0-9]+:COPYRIGHT")))))))))
 
     (when (eq grep-use-null-filename-separator 'auto-detect)
       (setq grep-use-null-filename-separator
             (with-temp-buffer
-              (let* ((hello-file (expand-file-name "HELLO" data-directory))
-                     (args `("--null" "-ne" "^English" ,hello-file)))
+              (let* ((hello-file (expand-file-name "README" data-directory))
+                     (args `("--null" "-ne" "^COPYRIGHT" ,hello-file)))
                 (if grep-use-null-device
                     (setq args (append args (list null-device)))
                   (push "-H" args))
@@ -656,7 +656,7 @@ grep-compute-defaults
                        (goto-char (point-min))
                        (looking-at
                         (concat (regexp-quote hello-file)
-                                "\0[0-9]+:English"))))))))
+                                "\0[0-9]+:COPYRIGHT"))))))))
 
     (when (eq grep-highlight-matches 'auto-detect)
       (setq grep-highlight-matches
-- 
2.11.0