bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

`match-data' set improperly


From: Matthew Swift
Subject: `match-data' set improperly
Date: Tue, 11 Feb 2003 22:16:57 -0500

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the address@hidden mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.2.1 (i386-debian-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2002-11-06 on beth, modified by Debian
configured using `configure  i386-debian-linux-gnu --prefix=/usr/local 
--sharedstatedir=/var/lib --libexecdir=/usr/local/lib --localstatedir=/var/lib 
--infodir=/usr/local/share/info --mandir=/usr/local/share/man --with-pop=yes 
--with-x=yes --with-x-toolkit=athena --without-gif'
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: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Evaluating the following `let' form gives varying results, but the results
should be consistent.  Correct results are always returned when `s' is "The
quick fox...", which matches the regexp `r'.  When `s' is "great grey
green...", which does not match `r', the results in my trials have never been
correct: either an 'args-out-of-range' error is raised, or incorrect data is
given, which appears to be the result of applying match-data from matching a
previous value of `s' ("The quick fox...") to the current value of `s'.  Sample
results are copied below.

My *guess* is that when `string-match' fails, it either fails to set
`match-data' or sets it incorrectly in one of two (or more) ways.

(let ((r "\\(qu\\)\\(ick\\)")
      ;; \C-x\C-t to swap next two lines
      ;; \M-\C-x to evaluate the `let' form
      (s "The quick fox jumped quickly.")
      (s "great grey green greasy Limpopo River")
      )
  (string-match r s)
  (list
   (match-data)
   (match-string 0 s)
   (match-string 1 s)
   (match-string 2 s)
   (match-string 3 s)
   (match-beginning 0)
   (match-beginning 1)
   (match-beginning 2)
   (match-beginning 3)
   ))


Debugger entered--Lisp error: (args-out-of-range "great grey green greasy 
Limpopo River" 27326 27327)
  match-string(0 "great grey green greasy Limpopo River")
  (list (match-data) (match-string 0 s) (match-string 1 s) (match-string 2 s) 
(match-string 3 s) (match-beginning 0) (match-beginning 1) (match-beginning 2) 
(match-beginning 3))
  (let ((r "\\(qu\\)\\(ick\\)") (s "The quick fox jumped quickly.") (s "great 
grey green greasy Limpopo River")) (string-match r s) (list (match-data) 
(match-string 0 s) (match-string 1 s) (match-string 2 s) (match-string 3 s) 
(match-beginning 0) (match-beginning 1) (match-beginning 2) (match-beginning 
3)))
  eval((let ((r "\\(qu\\)\\(ick\\)") (s "The quick fox jumped quickly.") (s 
"great grey green greasy Limpopo River")) (string-match r s) (list (match-data) 
(match-string 0 s) (match-string 1 s) (match-string 2 s) (match-string 3 s) 
(match-beginning 0) (match-beginning 1) (match-beginning 2) (match-beginning 
3))))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp)


Sometimes I get:

((4 9 4 6 6 9) "t gre" "t " "gre" nil 4 4 6 nil)

I get this less often, and I cannot tell you a reliable way to get it.  I
evaluate the `let' form, evaluate one or more individual lines
e.g. (match-beginning 2), swap the `s' strings, and evaluate the `let' form
again.  Then most of the time I still get the error, but sometimes I get these
incorrect results.

Notice that the match-data is the same as for a successful match of the other
string:

((4 9 4 6 6 9) quick qu ick nil 4 4 6 nil)






Recent input:
<mouse-1> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <down-mouse-1> <mouse-1> C-a C-n <return> 
M-1 C-n C-n C-n C-n C-n C-n <return> C-n C-n <return> 
M-1 C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-p <return> <help-echo> <help-echo> <down-mouse-1> 
<mouse-1> C-a C-SPC C-n C-n C-n C-n C-n C-n C-n C-SPC 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p M-w C-x o q g M-x r e p o r t - e m a c s - b u 
g <return>

Recent messages:
nndiary: Reading incoming mail (no new mail)...done
1 -> require: nnmail
1 <- require: nnmail
1 -> require: nnmail
1 <- require: nnmail
Checking new news...done
Loading emacsbug...
1 -> require: sendmail
1 <- require: sendmail
Loading emacsbug...done




reply via email to

[Prev in Thread] Current Thread [Next in Thread]