unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tobias Zawada <i_inbox@tn-home.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 34769@debbugs.gnu.org
Subject: bug#34769: Bug in emacs 26.1 gdb-send match-string applied after non-matching string-match
Date: Wed, 6 Mar 2019 21:10:54 +0100 (CET)	[thread overview]
Message-ID: <1047508139.239469.1551903054974@email.ionos.de> (raw)
In-Reply-To: <835zsvdfz4.fsf@gnu.org>

Dear Eli,
thanks for looking into this.

> > It is wrong to call (match-string 3 string) if (string-match gdb-control-commands-regexp string) returned nil.
> ...
> That is true, and a cleanup is a good idea. But please note that the
> undefined results are not used if control-command-p is nil, so the
> issue is not that serious.

The match data is that one of the previous successful matching operation.
One gets an args-out-of-range signal if the indexes in the match data are larger than the width of the string argument to match-string. That is how I discovered the error.

A reconstruction with gdb-send is too involved.
Instead I demonstrate the effect with the following orgmode source code block inclusive results:

#+BEGIN_SRC emacs-lisp
(string-match "\\(1\\) *\\(2\\)" "1          2")
(string-match "\\(3 \\(4\\)\\)" "1 2")
(append
 (match-data)
 (condition-case err
     (match-string 2 "1 2")
     (error (list err))))
#+END_SRC

#+RESULTS:
| 0 | 12 | 0 | 1 | 11 | 12 | (args-out-of-range 1 2 11 12) |

Best regards,
Tobias





  reply	other threads:[~2019-03-06 20:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-06 11:27 bug#34769: Bug in emacs 26.1 gdb-send match-string applied after non-matching string-match Tobias Zawada
2019-03-06 18:18 ` Eli Zaretskii
2019-03-06 20:10   ` Tobias Zawada [this message]
2019-03-07 15:18     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1047508139.239469.1551903054974@email.ionos.de \
    --to=i_inbox@tn-home.de \
    --cc=34769@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).