From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70122: 29.3.50; transpose-regions can crash Emacs Date: Mon, 01 Apr 2024 14:55:21 +0300 Message-ID: <86wmph9u1i.fsf@gnu.org> References: <2318820.ElGaqSPkdT@gabor> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20378"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70122@debbugs.gnu.org To: Braun =?UTF-8?Q?G=C3=A1bor?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 01 13:56:17 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rrGGv-00053t-Gf for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Apr 2024 13:56:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rrGGh-0007cN-Th; Mon, 01 Apr 2024 07:56:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rrGGe-0007bs-V1 for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2024 07:56:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rrGGd-0000zg-Ab for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2024 07:56:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rrGGg-0002aH-C2 for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2024 07:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Apr 2024 11:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70122 X-GNU-PR-Package: emacs Original-Received: via spool by 70122-submit@debbugs.gnu.org id=B70122.17119725399900 (code B ref 70122); Mon, 01 Apr 2024 11:56:02 +0000 Original-Received: (at 70122) by debbugs.gnu.org; 1 Apr 2024 11:55:39 +0000 Original-Received: from localhost ([127.0.0.1]:49758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrGGI-0002Zc-Qh for submit@debbugs.gnu.org; Mon, 01 Apr 2024 07:55:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60646) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrGGG-0002ZP-2n for 70122@debbugs.gnu.org; Mon, 01 Apr 2024 07:55:37 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rrGG7-0000tD-Fi; Mon, 01 Apr 2024 07:55:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=t1CcODlV/5iT0fU8eZBy9p2Q04mWBFFim7qWuoafubE=; b=SCj8Rduv1MUR8RRW8osw ScBclKEaHCntkA4GvVBTGtkagBqQbuul6u+LcnVj6sgGVSgWIT9Y7N8g554zD9JqMFpzI8PjfRbc2 uJ2y5zn4Zloy6sfSHdQTjIGtRQUGQmQre6SIebLiqP7ZBcLxvXGNHEA+Pe4A3rgVWw50aZgsMD8oe ixzziOX9XZPzOxrIvJA3ljGMqamcup8VahGzPrnj2GkM75Ny1Dpl61iZKy/kZEF1d/4/I24Lb4SAS nCeDHNHrHPYRCYzPQJqGakioIH31Qi+k/78A04rI7OFMxDt4FK8+aU8u6WLRcMO2+diH0+e/iE8RI VoFqN3ByUbJatg==; In-Reply-To: <2318820.ElGaqSPkdT@gabor> (message from Braun =?UTF-8?Q?G=C3=A1bor?= on Mon, 01 Apr 2024 12:02:35 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282470 Archived-At: > From: Braun Gábor > Date: Mon, 01 Apr 2024 12:02:35 +0200 > > I have the following file: > > File ~/.emacs.d/trans-regions-bug.el: > > (with-temp-buffer > (insert (propertize "a" 'face 'font-lock-variable-name-face)) > (insert ":\n") > (insert (propertize "b" 'face 'font-lock-variable-name-face)) > (insert ": \x2113\x2080\n") > (insert (propertize "v" 'face 'font-lock-variable-name-face)) > (insert ": scaling\n") > ;; Move last line to the beginning > (transpose-regions 1 1 10 21)) > > End of file ~/.emacs.d/trans-regions-bug.el: > > > After building Emacs as described in the INSTALL file, the following > command crashes Emacs: > > src/emacs -Q --batch -l ~/.emacs.d/trans-regions-bug.el > > The following appears: > > Fatal error 11: Segmentation fault > > > See below for debugging information. > > Please find attached a patch to transpose-regions > with added tests. (The patch intends to fix typos: > makes sure lengths in bytes and characters are not confused. Thanks, but could you please show the minimal change required to fix just the particular problem with this scenario (and perhaps explain the reason for the crash in words), without any cleanup and typo/confusion fixes? That would make it easier to review the patch, whereas with what you sent, it is hard to understand what exactly is being fixed. > One case (likely for optimization only) has been removed, > seemed too much trouble to get it right.) If you explain the reason for the crash, perhaps we could leave the optimization alone.