GNU bug report logs -
#6114
23.1; grep-read-files does incorrect wildcard match
Previous Next
Reported by: S Boucher <stbya <at> yahoo.com>
Date: Wed, 5 May 2010 19:42:01 UTC
Severity: normal
Found in version 23.1
Fixed in version 24.1
Done: Juri Linkov <juri <at> jurta.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6114 in the body.
You can then email your comments to 6114 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6114
; Package
emacs
.
(Wed, 05 May 2010 19:42:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
S Boucher <stbya <at> yahoo.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 05 May 2010 19:42:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
This bug is for (defun grep-read-files (regexp) in file grep.el.
In grep-read-files, there's a call to (wildcard-to-regexp (cdr alias))
with the assumption that (cdr alias) is a single pattern. However,
the variable grep-files-aliases actually can have multiple patterns
for each alias. So, the multi-pattern aliases, such as for "cc",
cannot correctly match:
(defcustom grep-files-aliases
'(("asm" . "*.[sS]")
("c" . "*.c")
("cc" . "*.cc *.cxx *.cpp *.C *.CC *.c++")
... etc...
In GNU Emacs 23.1.1 (i686-pc-linux-gnu, GTK+ Version 2.16.1)
of 2009-11-24 on stephbuntu
Windowing system distributor `The X.Org Foundation', version 11.0.10600000
configured using `configure '--prefix=/ws/EMACS/soft''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_CA.UTF-8
value of $XMODIFIERS: nil
locale-coding-system: utf-8-unix
default-enable-multibyte-characters: t
Major mode: Lisp Interaction
Minor modes in effect:
shell-dirtrack-mode: t
dynamic-completion-mode: t
tooltip-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
global-auto-composition-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
C-p
Recent messages:
Quit
Back to top level.
Mark set
Searched 1 buffer; 6 matches for `grep-files-aliases' [2 times]
uncompressing custom.el.gz...done [2 times]
Composing main Info directory...done
Found `bugs' in Index. (2 total; use `,' for next)
Making completion list... [2 times]
Quit
Making completion list...
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6114
; Package
emacs
.
(Thu, 06 May 2010 20:55:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 6114 <at> debbugs.gnu.org (full text, mbox):
> This bug is for (defun grep-read-files (regexp) in file grep.el.
>
> In grep-read-files, there's a call to (wildcard-to-regexp (cdr alias))
> with the assumption that (cdr alias) is a single pattern. However,
> the variable grep-files-aliases actually can have multiple patterns
> for each alias. So, the multi-pattern aliases, such as for "cc",
> cannot correctly match:
>
> (defcustom grep-files-aliases
> '(("asm" . "*.[sS]")
> ("c" . "*.c")
> ("cc" . "*.cc *.cxx *.cpp *.C *.CC *.c++")
> ... etc...
Evaluating
(wildcard-to-regexp "*.cc *.cxx *.cpp *.C *.CC *.c++")
returns
"\\`[^^@]*\\.cc [^^@]*\\.cxx [^^@]*\\.cpp [^^@]*\\.C [^^@]*\\.CC [^^@]*\\.c\\+\\+\\'"
Do you think it should be
"\\`[^^@]*\\.cc\\|[^^@]*\\.cxx\\|[^^@]*\\.cpp\\|[^^@]*\\.C\\|[^^@]*\\.CC\\|[^^@]*\\.c\\+\\+\\'"
?
--
Juri Linkov
http://www.jurta.org/emacs/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6114
; Package
emacs
.
(Fri, 21 May 2010 00:49:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 6114 <at> debbugs.gnu.org (full text, mbox):
> This bug is for (defun grep-read-files (regexp) in file grep.el.
>
> In grep-read-files, there's a call to (wildcard-to-regexp (cdr alias))
> with the assumption that (cdr alias) is a single pattern. However,
> the variable grep-files-aliases actually can have multiple patterns
> for each alias. So, the multi-pattern aliases, such as for "cc",
> cannot correctly match:
>
> (defcustom grep-files-aliases
> '(("asm" . "*.[sS]")
> ("c" . "*.c")
> ("cc" . "*.cc *.cxx *.cpp *.C *.CC *.c++")
> ... etc...
Does this patch do what you want? (Please note that we have to remove
"*" ("all") because it matches everything.)
=== modified file 'lisp/progmodes/grep.el'
--- lisp/progmodes/grep.el 2010-04-20 00:49:46 +0000
+++ lisp/progmodes/grep.el 2010-05-21 00:27:18 +0000
@@ -781,12 +781,17 @@ (defun grep-read-files (regexp)
(file-name-nondirectory bn)))
(default-alias
(and fn
- (let ((aliases grep-files-aliases)
+ (let ((aliases (remove (assoc "all" grep-files-aliases)
+ grep-files-aliases))
alias)
(while aliases
(setq alias (car aliases)
aliases (cdr aliases))
- (if (string-match (wildcard-to-regexp (cdr alias)) fn)
+ (if (string-match (mapconcat
+ 'wildcard-to-regexp
+ (split-string (cdr alias) nil t)
+ "\\|")
+ fn)
(setq aliases nil)
(setq alias nil)))
(cdr alias))))
--
Juri Linkov
http://www.jurta.org/emacs/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6114
; Package
emacs
.
(Fri, 21 May 2010 16:32:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 6114 <at> debbugs.gnu.org (full text, mbox):
Tried it. Seems to work.
Thanks,
--- On Thu, 5/20/10, Juri Linkov <juri <at> jurta.org> wrote:
> From: Juri Linkov <juri <at> jurta.org>
> Subject: Re: 23.1; grep-read-files does incorrect wildcard match
> To: "S Boucher" <stbya <at> yahoo.com>
> Cc: 6114 <at> debbugs.gnu.org
> Received: Thursday, May 20, 2010, 8:28 PM
> > This bug is for (defun
> grep-read-files (regexp) in file grep.el.
> >
> > In grep-read-files, there's a call to
> (wildcard-to-regexp (cdr alias))
> > with the assumption that (cdr alias) is a single
> pattern. However,
> > the variable grep-files-aliases actually can have
> multiple patterns
> > for each alias. So, the multi-pattern aliases,
> such as for "cc",
> > cannot correctly match:
> >
> > (defcustom grep-files-aliases
> > '(("asm" . "*.[sS]")
> > ("c" .
> "*.c")
> > ("cc" . "*.cc
> *.cxx *.cpp *.C *.CC *.c++")
> > ... etc...
>
> Does this patch do what you want? (Please note that
> we have to remove
> "*" ("all") because it matches everything.)
>
> === modified file 'lisp/progmodes/grep.el'
> --- lisp/progmodes/grep.el 2010-04-20
> 00:49:46 +0000
> +++ lisp/progmodes/grep.el 2010-05-21
> 00:27:18 +0000
> @@ -781,12 +781,17 @@ (defun grep-read-files (regexp)
>
> (file-name-nondirectory bn)))
> (default-alias
> (and fn
> - (let ((aliases
> grep-files-aliases)
> + (let ((aliases
> (remove (assoc "all" grep-files-aliases)
> +
>
> grep-files-aliases))
>
> alias)
> (while
> aliases
> (setq
> alias (car aliases)
>
> aliases (cdr aliases))
> - (if
> (string-match (wildcard-to-regexp (cdr alias)) fn)
> + (if
> (string-match (mapconcat
> +
>
> 'wildcard-to-regexp
> +
>
> (split-string (cdr alias) nil t)
> +
> "\\|")
> +
> fn)
>
> (setq aliases nil)
>
> (setq alias nil)))
> (cdr
> alias))))
>
> --
> Juri Linkov
> http://www.jurta.org/emacs/
>
Reply sent
to
Juri Linkov <juri <at> jurta.org>
:
You have taken responsibility.
(Fri, 21 May 2010 20:48:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
S Boucher <stbya <at> yahoo.com>
:
bug acknowledged by developer.
(Fri, 21 May 2010 20:48:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 6114-done <at> debbugs.gnu.org (full text, mbox):
> Tried it. Seems to work.
Thanks, committed.
--
Juri Linkov
http://www.jurta.org/emacs/
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 19 Jun 2010 11:24:03 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Mark Lillibridge <mark.lillibridge <at> hp.com>
to
control <at> debbugs.gnu.org
.
(Mon, 05 Dec 2011 02:58:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#6114
; Package
emacs
.
(Mon, 05 Dec 2011 03:06:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 6114 <at> debbugs.gnu.org (full text, mbox):
Looking at the code I see:
grep.el:778:
(defun grep-read-files (regexp)
"Read files arg for interactive grep."
(let* ((bn (or (buffer-file-name)
(replace-regexp-in-string "<[0-9]+>\\'" "" (buffer-name))))
(fn (and bn
(stringp bn)
(file-name-nondirectory bn)))
(default-alias
(and fn
(let ((aliases grep-files-aliases)
alias)
(while aliases
(setq alias (car aliases)
aliases (cdr aliases))
(if (string-match (wildcard-to-regexp (cdr alias)) fn)
(setq aliases nil)
(setq alias nil)))
(cdr alias))))
You'll note that the patch mentioned previously in this thread has
not been applied or has been lost at some point!
Please fix.
- Thanks,
Mark
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#6114
; Package
emacs
.
(Mon, 05 Dec 2011 05:58:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 6114 <at> debbugs.gnu.org (full text, mbox):
Mark Lillibridge wrote:
> You'll note that the patch mentioned previously in this thread has
> not been applied or has been lost at some point!
It was applied to the Emacs trunk 2010-05-21 and will be in Emacs 24.1.
You might like to try a pretest from alpha.gnu.org/gnu/emacs/pretest.
It was never applied to the emacs-23 branch, but there won't be any more
releases from that branch, so it is academic.
(I do encourage people to indicate the fixed version when they close a
bug.)
bug Marked as fixed in versions 24.1.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Mon, 05 Dec 2011 05:59:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#6114
; Package
emacs
.
(Thu, 08 Dec 2011 04:09:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 6114 <at> debbugs.gnu.org (full text, mbox):
Glenn Morris <rgm <at> gnu.org> writes:
> Mark Lillibridge wrote:
>
> > You'll note that the patch mentioned previously in this thread has
> > not been applied or has been lost at some point!
>
> It was applied to the Emacs trunk 2010-05-21 and will be in Emacs 24.1.
> You might like to try a pretest from alpha.gnu.org/gnu/emacs/pretest.
>
> It was never applied to the emacs-23 branch, but there won't be any more
> releases from that branch, so it is academic.
>
> (I do encourage people to indicate the fixed version when they close a
> bug.)
Ah, that explains it. Emacs 23.3 was released in March 2011 so I
naturally assumed it had this patch.
- Mark
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 05 Jan 2012 12:24:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 13 years and 227 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.