unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
@ 2018-07-08  9:33 David Kastrup
  2018-07-08  9:51 ` Michael Albinus
  0 siblings, 1 reply; 14+ messages in thread
From: David Kastrup @ 2018-07-08  9:33 UTC (permalink / raw)
  To: 32093


M-x grep RET

with the command line

    git grep --color -n -e simple_trans_list

results in

-*- mode: grep; default-directory: "/usr/local/tmp/lilypond/" -*-
Grep started at Sun Jul  8 11:29:44

git grep --color -n -e simple_trans_list /dev/null
fatal: /dev/null: '/dev/null' is outside repository

Grep exited abnormally with code 128 at Sun Jul  8 11:29:44


I did not ask for /dev/null to be appended to the command line, and
previous incantations didn't do it.  Obviously, not all grep-kind
programs are happy about that change.

In GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-06-20 built on lola
Repository revision: 94a85bd4e4f2e4805f042adde3754fcc325783cb
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04 LTS

Recent messages:
Saving /home/dak/.newsrc.eld...done
Making completion list...
Mark saved where search started
/usr/local/tmp/lilypond 
Reverting buffer ‘emacs-pager.iawaSB’.
When done with a buffer, type C-x #
Grep exited abnormally with code 128
funcall-interactively: Buffer is read-only: #<buffer emacs-pager.iawaSB>
Directory /usr/local/tmp/lilypond/
Grep exited abnormally with code 128 [2 times]

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LC_MONETARY: de_DE.UTF-8
  value of $LC_NUMERIC: POSIX
  value of $LC_TIME: de_DE.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Shell

Minor modes in effect:
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  TeX-PDF-mode: t
  diff-auto-refine-mode: t
  minibuffer-electric-default-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/dak/.emacs.d/elpa/auctex-12.1.0/auctex hides /usr/local/share/emacs/site-lisp/auctex
/home/dak/.emacs.d/elpa/auctex-12.1.0/tex-site hides /usr/local/share/emacs/site-lisp/tex-site

Features:
(shadow emacsbug grep view thingatpt vc vc-dispatcher jka-compr
git-rebase magit-obsolete magit-blame magit-stash magit-bisect
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-branch magit-files magit-refs magit-status subr-x magit
magit-repos magit-apply magit-wip magit-log magit-diff magit-core
magit-autorevert magit-process magit-margin magit-mode magit-git
magit-section magit-popup git-commit log-edit pcvs-util add-log
with-editor async-bytecomp async ediff-merg ediff-wind ediff-diff
ediff-mult ediff-help ediff-init ediff-util ediff magit-utils dash
dabbrev url-util shr-color color shr text-property-search svg dom
misearch multi-isearch browse-url gnus-dup cl-print debug flow-fill
mm-archive gnus-kill rfc2104 mailalias smtpmail sendmail nnir sort
smiley gnus-cite mail-extr gnus-async gnus-bcklg qp gnus-ml disp-table
pop3 nndraft gnutls network-stream nsm nndoc nndir nnmh nnml nnfolder
nnnil gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg
gnus-art mm-uu mml2015 mm-view mml-smime smime dig mailcap nntp
gnus-cache gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap
nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range message
rmc puny rfc822 mml mml-sec epa derived epg mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win
cl-extra help-mode vc-filewise vc-rcs conf-mode make-mode gnuplot-gui cl
gnuplot info-look dired-x dired dired-loaddefs python tramp-sh tramp
trampver tramp-compat tramp-loaddefs ucs-normalize parse-time
format-spec smerge-mode latexenc sh-script smie executable preview
prv-emacs reftex-dcr reftex-auc reftex reftex-loaddefs reftex-vars
tex-bar toolbar-x noutline outline font-latex tex-mode shell pcomplete
tex-buf latex edmacro kmacro tex-ispell tex-style tex-info tex dbus xml
crm texinfo lilypond-mode compile comint ansi-color ring cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs autorevert filenotify vc-git diff-mode easy-mmode scheme
elec-pair advice desktop frameset minibuf-eldef gnus nnheader gnus-util
rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums mail-utils mm-util
mail-prsvr wid-edit cus-start cus-load preview-latex server time-date
mule-util tex-site info finder-inf package easymenu epg-config
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 794087 118341)
 (symbols 48 60033 1)
 (miscs 40 1539 2133)
 (strings 32 147127 13081)
 (string-bytes 1 4666111)
 (vectors 16 83326)
 (vector-slots 8 2342372 139566)
 (floats 8 524 805)
 (intervals 56 27893 1511)
 (buffers 992 274))

-- 
David Kastrup





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-08  9:33 bug#32093: 27.0.50; M-x grep appends /dev/null to command line David Kastrup
@ 2018-07-08  9:51 ` Michael Albinus
  2018-07-08  9:53   ` David Kastrup
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2018-07-08  9:51 UTC (permalink / raw)
  To: David Kastrup; +Cc: 32093

David Kastrup <dak@gnu.org> writes:

> I did not ask for /dev/null to be appended to the command line, and
> previous incantations didn't do it.  Obviously, not all grep-kind
> programs are happy about that change.

--8<---------------cut here---------------start------------->8---
grep-use-null-device is a variable defined in ‘grep.el’.
Its value is ‘auto-detect’

Documentation:
If t, append the value of ‘null-device’ to ‘grep’ commands.
This is done to ensure that the output of grep includes the filename of
any match in the case where only a single file is searched, and is not
necessary if the grep program used supports the ‘-H’ option.

In interactive usage, the actual value of this variable is set up
by ‘grep-compute-defaults’; to change the default value, use
Customize or call the function ‘grep-apply-setting’.

You can customize this variable.
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-08  9:51 ` Michael Albinus
@ 2018-07-08  9:53   ` David Kastrup
  2018-07-08 10:05     ` Michael Albinus
  0 siblings, 1 reply; 14+ messages in thread
From: David Kastrup @ 2018-07-08  9:53 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 32093

Michael Albinus <michael.albinus@gmx.de> writes:

> David Kastrup <dak@gnu.org> writes:
>
>> I did not ask for /dev/null to be appended to the command line, and
>> previous incantations didn't do it.  Obviously, not all grep-kind
>> programs are happy about that change.
>
> grep-use-null-device is a variable defined in ‘grep.el’.
> Its value is ‘auto-detect’
>
> Documentation:
> If t, append the value of ‘null-device’ to ‘grep’ commands.
> This is done to ensure that the output of grep includes the filename of
> any match in the case where only a single file is searched, and is not
> necessary if the grep program used supports the ‘-H’ option.
>
> In interactive usage, the actual value of this variable is set up
> by ‘grep-compute-defaults’; to change the default value, use
> Customize or call the function ‘grep-apply-setting’.
>
> You can customize this variable.

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.

-- 
David Kastrup





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-08  9:53   ` David Kastrup
@ 2018-07-08 10:05     ` Michael Albinus
  2018-07-08 11:17       ` David Kastrup
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2018-07-08 10:05 UTC (permalink / raw)
  To: David Kastrup; +Cc: 32093

David Kastrup <dak@gnu.org> 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.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-08 10:05     ` Michael Albinus
@ 2018-07-08 11:17       ` David Kastrup
  2018-07-08 12:19         ` Noam Postavsky
  0 siblings, 1 reply; 14+ messages in thread
From: David Kastrup @ 2018-07-08 11:17 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 32093

Michael Albinus <michael.albinus@gmx.de> writes:

> David Kastrup <dak@gnu.org> 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





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-08 11:17       ` David Kastrup
@ 2018-07-08 12:19         ` Noam Postavsky
  2018-07-08 12:30           ` David Kastrup
  2018-07-08 19:04           ` Eli Zaretskii
  0 siblings, 2 replies; 14+ messages in thread
From: Noam Postavsky @ 2018-07-08 12:19 UTC (permalink / raw)
  To: David Kastrup; +Cc: 32093, Michael Albinus

David Kastrup <dak@gnu.org> writes:

> 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)

> 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.

The reason for the current breakage is actually the changes to the HELLO
file, the string "English" is no longer at the beginning of the line
since [1: 3589c966b7].  The reason the auto detection previously worked,
despite HELLO not being in the current git repository, is that the
autodetection works with plain "grep", not "git grep".  Autodetection
happens before you get the prompt, so you haven't even typed in "git"
yet.

[1: 3589c966b7]: 2018-05-19 18:17:38 +0300
  Use Enriched mode in etc/HELLO to keep charset information
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3589c966b743850c29b89b83710783d4ea026770





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-08 12:19         ` Noam Postavsky
@ 2018-07-08 12:30           ` David Kastrup
  2018-07-08 19:04           ` Eli Zaretskii
  1 sibling, 0 replies; 14+ messages in thread
From: David Kastrup @ 2018-07-08 12:30 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 32093, Michael Albinus

Noam Postavsky <npostavs@gmail.com> writes:

> David Kastrup <dak@gnu.org> writes:
>
>> 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)
>
>> 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.
>
> The reason for the current breakage is actually the changes to the HELLO
> file, the string "English" is no longer at the beginning of the line
> since [1: 3589c966b7].

Ok, that's actually funny.

> The reason the auto detection previously worked, despite HELLO not
> being in the current git repository, is that the autodetection works
> with plain "grep", not "git grep".  Autodetection happens before you
> get the prompt, so you haven't even typed in "git" yet.

So basically previously the proposed grep command line and autodetection
was working for me since both system grep and git-grep support -H .

Now while it makes sense to fix the HELLO file problem, I feel that it's
sort of unfortunate that /dev/null is silently tacked onto the command
line after user entry completes as opposed to the flags which are
entered previous to that.  But I don't have a good idea how to do that
while giving the user something sensible and editable to work with.

-- 
David Kastrup





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-08 12:19         ` Noam Postavsky
  2018-07-08 12:30           ` David Kastrup
@ 2018-07-08 19:04           ` Eli Zaretskii
  2018-07-08 19:11             ` David Kastrup
                               ` (2 more replies)
  1 sibling, 3 replies; 14+ messages in thread
From: Eli Zaretskii @ 2018-07-08 19:04 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 32093, dak, michael.albinus

> From: Noam Postavsky <npostavs@gmail.com>
> Date: Sun, 08 Jul 2018 08:19:47 -0400
> Cc: 32093@debbugs.gnu.org, Michael Albinus <michael.albinus@gmx.de>
> 
> file, the string "English" is no longer at the beginning of the line
> since [1: 3589c966b7].

Oops!

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





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-08 19:04           ` Eli Zaretskii
@ 2018-07-08 19:11             ` David Kastrup
  2018-07-09 21:43             ` Noam Postavsky
  2018-07-09 23:10             ` Noam Postavsky
  2 siblings, 0 replies; 14+ messages in thread
From: David Kastrup @ 2018-07-08 19:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32093, michael.albinus, Noam Postavsky

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Noam Postavsky <npostavs@gmail.com>
>> Date: Sun, 08 Jul 2018 08:19:47 -0400
>> Cc: 32093@debbugs.gnu.org, Michael Albinus <michael.albinus@gmx.de>
>> 
>> file, the string "English" is no longer at the beginning of the line
>> since [1: 3589c966b7].
>
> Oops!
>
> But is there a good reason why we use HELLO for that?  Why not README,
> say, whose first line will always start with "Copyright"?

Not if the FSF's mission is wildly successful.  But we could still
change the README to state

    Copyright, like to any other software, no longer applies to this
    file.

which would keep the test working.

-- 
David Kastrup





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-08 19:04           ` Eli Zaretskii
  2018-07-08 19:11             ` David Kastrup
@ 2018-07-09 21:43             ` Noam Postavsky
  2018-07-10  7:33               ` David Kastrup
  2018-07-10 15:55               ` Eli Zaretskii
  2018-07-09 23:10             ` Noam Postavsky
  2 siblings, 2 replies; 14+ messages in thread
From: Noam Postavsky @ 2018-07-09 21:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32093, dak, michael.albinus

[-- Attachment #1: Type: text/plain, Size: 453 bytes --]

Eli Zaretskii <eliz@gnu.org> 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).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2632 bytes --]

From 3b0f302b7d06c37cc6fbff2f1e18904020de51f2 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-08 19:04           ` Eli Zaretskii
  2018-07-08 19:11             ` David Kastrup
  2018-07-09 21:43             ` Noam Postavsky
@ 2018-07-09 23:10             ` Noam Postavsky
  2 siblings, 0 replies; 14+ messages in thread
From: Noam Postavsky @ 2018-07-09 23:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32093, dak, michael.albinus

tags 32093 fixed
close 32093 
quit

Eli Zaretskii <eliz@gnu.org> 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 see Paul fixed this by searching for "Copyright" in HELLO.

[9d09ced1d5]: 2018-07-08 10:01:33 -0700
  Fix etc/HELLO searching in grep.el
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=9d09ced1d5d124893fbe9c176f821f6716e91392





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-09 21:43             ` Noam Postavsky
@ 2018-07-10  7:33               ` David Kastrup
  2018-07-10 15:55               ` Eli Zaretskii
  1 sibling, 0 replies; 14+ messages in thread
From: David Kastrup @ 2018-07-10  7:33 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: michael.albinus, 32093

Noam Postavsky <npostavs@gmail.com> writes:

>>From 3b0f302b7d06c37cc6fbff2f1e18904020de51f2 Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <npostavs@gmail.com>
> 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)))

Using `hello-file' for indicating "README" does not particularly help
reading comprehension.

-- 
David Kastrup





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-09 21:43             ` Noam Postavsky
  2018-07-10  7:33               ` David Kastrup
@ 2018-07-10 15:55               ` Eli Zaretskii
  2018-07-10 22:04                 ` Noam Postavsky
  1 sibling, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2018-07-10 15:55 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 32093, dak, michael.albinus

> From: Noam Postavsky <npostavs@gmail.com>
> Cc: 32093@debbugs.gnu.org,  dak@gnu.org,  michael.albinus@gmx.de
> Date: Mon, 09 Jul 2018 17:43:46 -0400
> 
> > 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).

I meant the top-level README, which I think always will include a
Copyright line.

But that was just a suggestion.  I see Paul decided to continue using
etc/HELLO, just with a different search patterns.  If we are OK with
that, we can put that issue to rest.

There's still a broader issue of whether a test done with plain 'grep'
holds for any other "grep-like" program.  I'm not sure what to do with
that.

We could even take one more step back and ask ourselves why do we need
this particular test.  I believe it's because we want to support file
names with embedded newlines, in which case perhaps such niche use
cases could be supported by a special command or a special user
option?  I mean, it sounds strange to let a tail wag the dog, no?





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#32093: 27.0.50; M-x grep appends /dev/null to command line
  2018-07-10 15:55               ` Eli Zaretskii
@ 2018-07-10 22:04                 ` Noam Postavsky
  0 siblings, 0 replies; 14+ messages in thread
From: Noam Postavsky @ 2018-07-10 22:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32093, dak, michael.albinus

On 10 July 2018 at 11:55, Eli Zaretskii <eliz@gnu.org> wrote:

> But that was just a suggestion.  I see Paul decided to continue using
> etc/HELLO, just with a different search patterns.  If we are OK with
> that, we can put that issue to rest.

Yeah, I don't think it really matters whether we search etc/HELLO or README.

> We could even take one more step back and ask ourselves why do we need
> this particular test.  I believe it's because we want to support file
> names with embedded newlines, in which case perhaps such niche use
> cases could be supported by a special command or a special user
> option?

I don't think it's about newlines in filenames (in fact,
grep-regexp-alist doesn't support that regardless).  As far as I can
tell, the HELLO test is checking whether we can pass -H to get the
filename together with the matches, or if we need to pass multiple files
to do that.

To do without -H, we would need to handle matches in both formats which
would make the matching regexp more complicated, and we would need to be
able to extract the filename from the shell command that the user types
in.  That would be quite difficult to do correctly in general.





^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-07-10 22:04 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-08  9:33 bug#32093: 27.0.50; M-x grep appends /dev/null to command line David Kastrup
2018-07-08  9:51 ` Michael Albinus
2018-07-08  9:53   ` David Kastrup
2018-07-08 10:05     ` Michael Albinus
2018-07-08 11:17       ` David Kastrup
2018-07-08 12:19         ` Noam Postavsky
2018-07-08 12:30           ` David Kastrup
2018-07-08 19:04           ` Eli Zaretskii
2018-07-08 19:11             ` David Kastrup
2018-07-09 21:43             ` Noam Postavsky
2018-07-10  7:33               ` David Kastrup
2018-07-10 15:55               ` Eli Zaretskii
2018-07-10 22:04                 ` Noam Postavsky
2018-07-09 23:10             ` Noam Postavsky

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).