From: Eli Zaretskii <eliz@gnu.org>
To: npostavs@users.sourceforge.net
Cc: ahyatt@gmail.com, schochet@post.tau.ac.il, 5131-done@debbugs.gnu.org
Subject: bug#5131: Subject: 23.1; interaction of transpose-regions with markers and multibyte chars
Date: Tue, 19 Jul 2016 19:05:09 +0300 [thread overview]
Message-ID: <8360s11umi.fsf@gnu.org> (raw)
In-Reply-To: <874m7oeus5.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net)
> From: npostavs@users.sourceforge.net
> Date: Sun, 17 Jul 2016 00:46:34 -0400
> Cc: schochet@post.tau.ac.il, 5131@debbugs.gnu.org
>
> Andrew Hyatt <ahyatt@gmail.com> writes:
>
> > Sorry for the late reply. I can reproduce the problem of unexpected
> > characters when transposing using markers in Emacs 25.
> >
> > schochet@post.tau.ac.il writes:
> >
> >> ;-*- mode: lisp-interaction; coding: utf-8-unix -*-
> >>
> >> ; case 1: abcd was: abcd
> >> ; case 2: ÷bcd was: ÷bcd
> >> ; case 3: ÷ab"äé was: ÷ab"äé
> >>
> >> (progn (defvar start nil) (defvar len nil)) ;do \C-j here
> >>
> >> ; Using markers to move multi-byte characters may cause problems
> >>
> >> (progn (setq begm (make-marker)) (setq endm (make-marker))) ;do \C-j here
> >>
> >> (defun reverse-all ()
> >> (set-marker begm start)
> >> (set-marker endm (+ start (1- len)))
> >> (while (> endm begm)
> >> (progn (transpose-regions begm (1+ begm) endm (1+ endm) t)
> >> (set-marker begm (1+ begm))
> >> (set-marker endm (1- endm))))) ;do \C-j here
> >>
> >> ;case1
> >> (progn (setq start 64) (setq len 4) (reverse-all)) ;do \C-j here
> >>
> >> ;case2
> >> (progn (setq start 94) (setq len 4) (reverse-all)) ;do \C-j here
> >>
> >> ;case3
> >> (progn (setq start 124) (setq len 6) (reverse-all)) ;do \C-j here
>
> With the latest emacs-25 branch after evaluating up to case3 here, I get
> an abort, here is the backtrace:
>
> (gdb) bt
> #0 0x00007ffff1218d59 in raise () from /usr/lib/libpthread.so.0
> #1 0x00000000005738c4 in terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at emacs.c:381
> #2 0x0000000000600d84 in die (msg=0x6f4140 "IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it))", file=0x6f1ff0 "xdisp.c",
> line=7442) at alloc.c:7223
> #3 0x0000000000452c1c in set_iterator_to_next (it=0x7fffffff90f0, reseat_p=true) at xdisp.c:7442
That's because your build is with --enable-checking, while Andrew's
probably isn't. This recipe causes some markers to have invalid
bytepos values, so any code that calls CHAR_TO_BYTE is likely to crash
or cause assertion violations.
It feels strange to fix bugs that were introduced 18 years ago; I
guess almost no one invokes transpose-regions with last argument
non-nil.
Fixed on the master branch. I'm closing the bug; feel free to reopen
if there are some left-overs.
Thanks.
prev parent reply other threads:[~2016-07-19 16:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-06 2:22 bug#5131: Subject: 23.1; interaction of transpose-regions with markers and multibyte chars schochet
2016-07-17 4:13 ` Andrew Hyatt
2016-07-17 4:46 ` npostavs
2016-07-19 16:05 ` Eli Zaretskii [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8360s11umi.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=5131-done@debbugs.gnu.org \
--cc=ahyatt@gmail.com \
--cc=npostavs@users.sourceforge.net \
--cc=schochet@post.tau.ac.il \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.