From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Matthew Swift Newsgroups: gmane.emacs.bugs Subject: `match-data' set improperly Date: Tue, 11 Feb 2003 22:16:57 -0500 Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <200302120316.h1C3Gvcu007789@beth.swift.xxx> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1045019733 1899 80.91.224.249 (12 Feb 2003 03:15:33 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 12 Feb 2003 03:15:33 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18inMw-0000UT-00 for ; Wed, 12 Feb 2003 04:15:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18inOb-0000Ok-02 for gnu-bug-gnu-emacs@m.gmane.org; Tue, 11 Feb 2003 22:17:13 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18inOT-0000MG-00 for bug-gnu-emacs@gnu.org; Tue, 11 Feb 2003 22:17:05 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18inOS-0000M0-00 for bug-gnu-emacs@gnu.org; Tue, 11 Feb 2003 22:17:04 -0500 Original-Received: from pool-68-160-54-133.bos.east.verizon.net ([68.160.54.133] helo=beth.swift.xxx) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18inOR-0000Lq-00 for bug-gnu-emacs@gnu.org; Tue, 11 Feb 2003 22:17:03 -0500 Original-Received: from alum.mit.edu (swift@localhost [127.0.0.1]) h1C3Gvcu007789 for ; Tue, 11 Feb 2003 22:16:57 -0500 Original-To: bug-gnu-emacs@gnu.org X-Mailscanner: clean (beth.swift.xxx) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:4431 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:4431 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 bug-gnu-emacs@gnu.org 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: C-a C-n M-1 C-n C-n C-n C-n C-n C-n C-n C-n 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 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 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