From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vladimir Panteleev Newsgroups: gmane.emacs.bugs Subject: bug#52798: 27.2; `undo' causes `buffer-undo-list' to grow exponentially Date: Sun, 26 Dec 2021 00:59:59 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31425"; mail-complaints-to="usenet@ciao.gmane.io" To: 52798@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 26 02:31:33 2021 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 1n1INo-00083u-Ee for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Dec 2021 02:31:32 +0100 Original-Received: from localhost ([::1]:52376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n1INn-0001uh-7Z for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Dec 2021 20:31:31 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n1INP-0001tA-DU for bug-gnu-emacs@gnu.org; Sat, 25 Dec 2021 20:31:08 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n1INK-00011S-Du for bug-gnu-emacs@gnu.org; Sat, 25 Dec 2021 20:31:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n1INK-0005CG-Bl for bug-gnu-emacs@gnu.org; Sat, 25 Dec 2021 20:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Vladimir Panteleev Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Dec 2021 01:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52798 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164048224619942 (code B ref -1); Sun, 26 Dec 2021 01:31:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Dec 2021 01:30:46 +0000 Original-Received: from localhost ([127.0.0.1]:40069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n1IN2-0005BV-8i for submit@debbugs.gnu.org; Sat, 25 Dec 2021 20:30:46 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:45778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n1Htn-0004KQ-DB for submit@debbugs.gnu.org; Sat, 25 Dec 2021 20:00:32 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n1Htk-0001Xk-PE for bug-gnu-emacs@gnu.org; Sat, 25 Dec 2021 20:00:29 -0500 Original-Received: from [2607:f8b0:4864:20::934] (port=44597 helo=mail-ua1-x934.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n1Htf-0002fc-IU for bug-gnu-emacs@gnu.org; Sat, 25 Dec 2021 20:00:26 -0500 Original-Received: by mail-ua1-x934.google.com with SMTP id p2so20718022uad.11 for ; Sat, 25 Dec 2021 17:00:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=d+zON15S98ZuBXQ5qLsrfYGePnH3pySN9jDOrmbIGik=; b=l0O+zmrlnr3hiMutrzGBhqhDzUFjLXTkqJXMxReQrr9+tqVQQa5giqRBcmTIGiWDqv O62IlQn+FLe/h+3R1O4Cn4tP38yUmSujhVpN++Txb3dM0SNF+EPAbAQ7ihqE8xu7KRfA I3NBJj+6xEvh/CkZYJ6b3LD89VEtoBqiFuzpy/Z5ePkZOrMCkusloC77Qot+zio/GY5V N5PYJf0PzaQK0D3CSqORU4Dh4V5S2e/OW78qIH9O1AM7YSDvpHxR626C039iiZvCvmcS 6rbG5KPisINM8UHTRT47HFVPt5DacLNrtk3zxvH0bC0I9/MRCNgnHDtnvPxmFalDsrsb QwdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=d+zON15S98ZuBXQ5qLsrfYGePnH3pySN9jDOrmbIGik=; b=ezhNjJDccuMYuv8iQ9JHD4++wUYDK2TtGv16j4VDLXrPgmX+KXsgCXSqurM8MzUYuU M8aBDeOYwXLVyA4VFz6EtfdncXSri5/fG/hemR3RZ6AmgCdnXvjZ4NUKdC+9V84JX77D K513y0O9NVIfWHmAIxRE+p+/T4qrEXzO2fzALzeh1Bf0RYCOfNYtv63j9m3LFRybAiFT UbgGwGP9/TTbPxlxe9dFHAtm0cbuS/H50yOAft6IMANm/WCW01BqfiS1RpxpUj8/N7lu p4EBpOazuJY7RO7m6Z9znDAvuXRRNi7L8QRvA5SqrFm5gJCX19xHzHa4oaW4dm5KOHYu K5Vw== X-Gm-Message-State: AOAM531kkY6Qxkxr3sbE1yODcLjJMl9zUQoUSOYuOOgKcL0L0joEkXLo tysqGyB75ooVnNnnnLOor3+RuuvBQ3lcq7Dq3OCy+QujzeMTfDyW X-Google-Smtp-Source: ABdhPJxHtHnKQ/vv4yTdWZvYh+zK3U04bXYJ5aozik1GHIfZlynvl5hL9mu89R1q9CsgdvhJpM8WFKGtYvIrmIZJ+E8= X-Received: by 2002:ab0:3117:: with SMTP id e23mr3472631ual.38.1640480415390; Sat, 25 Dec 2021 17:00:15 -0800 (PST) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::934 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::934; envelope-from=thecybershadow@gmail.com; helo=mail-ua1-x934.google.com X-Spam_score_int: 17 X-Spam_score: 1.7 X-Spam_bar: + X-Spam_report: (1.7 / 5.0 requ) AC_FROM_MANY_DOTS=2.999, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 25 Dec 2021 20:30:42 -0500 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" Xref: news.gmane.io gmane.emacs.bugs:223129 Archived-At: Consider this Emacs Lisp script: --- (eval-when-compile (require 'cl-lib)) (with-current-buffer (get-buffer-create "undo-test") ;; First, insert 50 characters. ;; Place an undo boundary after every insertion. (cl-loop repeat 50 do (insert "x") (undo-boundary)) ;; Then, undo 50 times. ;; It doesn't matter if we use undo or undo-only. ;; We will only get into about 12 undos, ;; before the new exponentially-growing entries erase the old history. (cl-loop repeat 50 do (undo-only) (message "Length is now: %S" (length buffer-undo-list)))) --- When executed with `emacs --script test.el', I see the following output: --- Undo Length is now: 102 Undo Length is now: 104 Undo Length is now: 108 Undo Length is now: 116 Undo Length is now: 132 Undo Length is now: 164 Undo Length is now: 228 Undo Length is now: 356 Undo Length is now: 612 Undo Length is now: 1124 Undo Length is now: 2148 Undo Length is now: 4196 Undo Length is now: 8292 No further undo information --- As far as I can see, the undo (and undo-only) command causes buffer-undo-list to grow exponentially. This causes information about previous entries to eventually be displaced. N.B.: I noticed that upping gc-cons-threshold lets it do more undos, but it does not prevent the exponential growth issue. I think this is a bug by itself, but it's worth mentioning that this script is a reduced version of a different problem I'm seeing with the "No further undo information" message; the bug described here may or may not be the root cause of that bug. In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4) of 2021-03-26 built on juergen Windowing system distributor 'The X.Org Foundation', version 11.0.12101002 System Description: Arch Linux Configured using: 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-wide-int --with-modules --with-cairo --with-harfbuzz 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' Configured features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP Important settings: value of $LC_TIME: en_DK.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix