From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Braun =?UTF-8?Q?G=C3=A1bor?= Newsgroups: gmane.emacs.bugs Subject: bug#70122: 29.3.50; transpose-regions can crash Emacs Date: Fri, 12 Apr 2024 11:39:34 +0200 Message-ID: <8400498.NyiUUSuA9g@gabor> References: <2318820.ElGaqSPkdT@gabor> <3216728.5fSG56mABF@gabor> <86frw191ht.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35113"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70122@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 12 11:40:08 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 1rvDOC-00090U-CI for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Apr 2024 11:40:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rvDNz-0007GW-5Z; Fri, 12 Apr 2024 05:39:55 -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 1rvDNx-0007G7-2r for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2024 05:39:53 -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 1rvDNw-0005Wo-Jr for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2024 05:39:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rvDO6-0003cL-83 for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2024 05:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Braun =?UTF-8?Q?G=C3=A1bor?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Apr 2024 09:40: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.171291479613836 (code B ref 70122); Fri, 12 Apr 2024 09:40:02 +0000 Original-Received: (at 70122) by debbugs.gnu.org; 12 Apr 2024 09:39:56 +0000 Original-Received: from localhost ([127.0.0.1]:57902 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rvDNz-0003aw-1R for submit@debbugs.gnu.org; Fri, 12 Apr 2024 05:39:56 -0400 Original-Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:60621) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rvDNv-0003ZI-KV for 70122@debbugs.gnu.org; Fri, 12 Apr 2024 05:39:53 -0400 Original-Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-56c5d05128dso713064a12.0 for <70122@debbugs.gnu.org>; Fri, 12 Apr 2024 02:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712914776; x=1713519576; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bjbytr0Aqb2kd/e1leOlUz6+pbXTwMpenuFau/eQhjs=; b=fQS+XNzw1ZN5h8PmFVLt0aUfJ+qUKIc8O9mnBwNGunWkkWOQZkFaDKSzL2ERBKgvry clkFBjBIqn3nBQqfburYn7MidBvVjQj2v1P2zAD0xQecnO9PbbS/WXmeBm3IlOOxMZNw 6/UA9mUPNehgTjj3Nzf7WxhvDl8DMwa0I1lalWFx/u0LFZNnk7rmNOPK8mqg4QaIdMOH wkfm7SN2KDcXRwCRhhDZwGdRpn8Zt47sqIC58acrGXFlowfLJeHYIe246EE24zaC/YTD Fp5vjUEVvllnvIQw5nqS4dCaQ1NRdzw3OetGqSynu9JNs+geFCREmqTiAEinFZcAlVod +M2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712914776; x=1713519576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bjbytr0Aqb2kd/e1leOlUz6+pbXTwMpenuFau/eQhjs=; b=updx879Y/6r6u6G7oC46r2Zebzi5LY2AmDumEPKuhrvfaCv3ksCKiUaU3DrwsS9BHA 0aV7QdfK3lxlCkxWeq67S9B0gMU+7IV0oMwvKNlCoUsC7jdJ90ls8Eg+TXIPlbP91VqY 6j8xSxpG9zex9dnhZfnauE0n+FMKDUgnx9YuwuIpcK+SSOyNBUeVp7L3O6g6gBIu9pWp j/z1/rSrnzmaHsOfsqg1eI6ZoYe5XPvdYWtRGkWagPMCiMu2qZ+lWjN1K8Xjz+bnWed1 XyZv4PEoT4F1RY6ua6FKwIUGLbyOmGg2PLajllmaI4ZDnuGV+ljIGFel57+lUa40nKtu ftJg== X-Gm-Message-State: AOJu0Yw1XQbX33kHqg7YDvRN3zyQb92EC/qOCFs964TeqO/GnUGHoxWy WaFJll7tV6EyCM6brfrcCCAazcR+57yk4sTgGcKZ0m19BJos2hQQ X-Google-Smtp-Source: AGHT+IHIy98NNwvuTjNQ0piHallIqOJtLOcsDHE5+8Eqc+LTwtqBEnG7Ly3UAvNX5b9j0EHAR0Pxsw== X-Received: by 2002:a50:d611:0:b0:56f:e609:743 with SMTP id x17-20020a50d611000000b0056fe6090743mr1435889edi.35.1712914775810; Fri, 12 Apr 2024 02:39:35 -0700 (PDT) Original-Received: from gabor.localnet ([2001:9e8:1565:7c00:3935:88e7:95c6:1e91]) by smtp.gmail.com with ESMTPSA id n16-20020a05640205d000b0056fea963056sm1317964edx.7.2024.04.12.02.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 02:39:35 -0700 (PDT) In-Reply-To: <86frw191ht.fsf@gnu.org> 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:283127 Archived-At: Hi Eli, Sorry for answering late. > Can we lift that restriction by augmenting the len1_byte =3D=3D=20 len2_byte > branch so that the len1 =3D=3D len2 condition is not needed? I could only come up with one that has minimal difference to to the other branches. I've attached it. I've tried to preserve the undo entries as changes in the two=20 regions, but I couldn't make it (one of my tests failed), so now it is a change in the large region as in the other=20 branches, and the tests pass. The issue I was unable to solve is that the functions set_text_properties_1 and graft_intervals_into_buffer record text property changes in undo history, but this is unwanted=20 here as transpose-regions handles undo history itself. These entries don't cause trouble because they happen to be=20 followed by a deletion of the text where properties change, and this applies to all branches of transpose-regions. I'd really like to use a version of these functions with: "change=20 text properties, but leave it to us to record it in undo history". =20 > This says the test that crashed was the one of the two new ones=20 you > added, and it is different from the one you presented at the=20 beginning > of this bug report. OK, sorry for that. > > With the tests I intended to test all the branches in the code > > where the regions don't touch each other, catching mistakes > > where the wrong length is used. >=20 > Can we also have a test where the byte lengths are equal, but=20 the > character lengths aren't? There is already one there: the test which loops over examples and adds characters is meant to cover various cases for the byte lengths, including when they are equal. As mentioned above,=20 I had this test failing in this case during patch development. > > I hoped that byte length is not system dependent, >=20 > It isn't, not if you consider the internal representation of > characters in Emacs buffers and strings. OK, maybe the issue was that I've sent a different test, as you mentioned. > Last, but not least: with the added tests your patch becomes=20 larger > than what we can accept without your assigning the copyright to=20 the > FSF. Would you like to start the legal paperwork of copyright > assignment at this time Let's start the paperwork. Best wishes, G=C3=A1bor Braun