GNU bug report logs - #77704
30.1; xml-mode enters infinite loop when saving with unclosed XML comment

Previous Next

Package: emacs;

Reported by: TANIKAWAKoji <kojie.yk <at> icloud.com>

Date: Thu, 10 Apr 2025 14:09:02 UTC

Severity: normal

Found in version 30.1

To reply to this bug, email your comments to 77704 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#77704; Package emacs. (Thu, 10 Apr 2025 14:09:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to TANIKAWAKoji <kojie.yk <at> icloud.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 10 Apr 2025 14:09:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: TANIKAWAKoji <kojie.yk <at> icloud.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.1; xml-mode enters infinite loop when saving with unclosed XML 
 comment
Date: Thu, 10 Apr 2025 16:49:25 +0900
To reproduce:

1. emacs -Q
2. Open a new buffer and enter: <!--
3. Set mode to xml-mode: M-x xml-mode
4. Save buffer: C-x C-s

Expected: Save succeeds, or a warning about unclosed comment.

Actual: Emacs enters an infinite loop or hangs. Requires external termination.

Notes:
- Adding --> afterwards doesn't clear the loop unless syntax-propertize is run manually.
- Occurs reliably in xml-mode, not in nxml-mode.
- Possibly related to scan-sexps or syntax-propertize caching.

System:
- Emacs 29.x on macOS (Apple Silicon)
- Reproducible: 100%





In GNU Emacs 30.1 (build 1, aarch64-apple-darwin21.6.0, NS
appkit-2113.65 Version 12.7.6 (Build 21H1320)) of 2025-02-24 built on
armbob.lan
Windowing system distributor 'Apple', version 10.3.2575
System Description:  macOS 15.3.1

Configured using:
'configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp' --with-modules 'CFLAGS=-DFD_SETSIZE=10000
-DDARWIN_UNLIMITED_SELECT' --with-x-toolkit=no'

Configured features:
ACL GLIB GMP GNUTLS JPEG LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER PNG
RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM ZLIB

Important settings:
  value of $LANG: ja_JP.UTF-8
  locale-coding-system: utf-8-unix

Major mode: nXML

Minor modes in effect:
  helm-mode: t
  helm-minibuffer-history-mode: t
  rng-validate-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  which-key-mode: t
  override-global-mode: t
  global-hl-line-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/Users/kojie/.emacs.d/elpa/which-key-20240620.2145/which-key hides /Applications/Emacs.app/Contents/Resources/lisp/which-key
/Users/kojie/.emacs.d/elpa/transient-20250205.2244/transient hides /Applications/Emacs.app/Contents/Resources/lisp/transient

Features:
(shadow sort mail-extr emacsbug message yank-media puny rfc822 mml
mml-sec epa derived epg rfc6068 epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils winner
tramp-archive tramp-gvfs dbus xml helm-command helm-elisp helm-eval
edebug debug backtrace helm-info helm-mode helm-misc helm-files
image-dired image-dired-tags image-dired-external image-dired-util
image-mode dired dired-loaddefs exif filenotify tramp trampver
tramp-integration files-x tramp-message tramp-compat xdg shell
parse-time iso8601 tramp-loaddefs helm-buffers helm-x-icons helm-occur
helm-tags helm-locate helm-grep helm-regexp helm-utils helm-help
helm-types helm helm-global-bindings helm-easymenu helm-core helm-source
helm-multi-match helm-lib async rng-xsd xsd-regexp rng-cmpct rng-nxml
rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util
rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap sgml-mode facemenu dom
nxml-util nxml-enc xmltok company-oddmuse company-keywords company-etags
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb company flycheck rainbow-mode color org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src sh-script
treesit executable ob-comint org-pcomplete pcomplete org-list
org-footnote org-faces org-entities time-date noutline outline
org-version ob-emacs-lisp ob-core ob-eval org-cycle org-table ol
org-fold org-fold-core org-keys oc org-loaddefs find-func cal-menu
calendar cal-loaddefs org-compat org-macs format-spec undo-tree diff
queue which-key lua-mode edmacro kmacro perl-mode ruby-mode smie
rust-utils rust-prog-mode rx rust-mode rust-playpen rust-cargo
rust-common rust-rustfmt rust-compile go-mode find-file ffap thingatpt
etags fileloop generator xref project compile text-property-search
comint ansi-osc ansi-color ring cl-extra help-mode use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core finder-inf
hl-line display-line-numbers company-autoloads flycheck-autoloads
go-mode-autoloads helm-autoloads helm-core-autoloads async-autoloads
lsp-ui-autoloads lsp-mode-autoloads f-autoloads lua-mode-autoloads
magit-autoloads pcase magit-section-autoloads llama-autoloads
markdown-mode-autoloads neotree-autoloads python-mode-autoloads
rainbow-mode-autoloads rust-mode-autoloads spinner-autoloads
transient-autoloads treemacs-autoloads cfrs-autoloads posframe-autoloads
ht-autoloads hydra-autoloads lv-autoloads pfuture-autoloads
ace-window-autoloads avy-autoloads s-autoloads dash-autoloads
undo-tree-autoloads queue-autoloads wfnames-autoloads
which-key-autoloads with-editor-autoloads info yatex-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs icons
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars cl-loaddefs cl-lib japan-util rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 492670 105067) (symbols 48 33810 1)
  (strings 32 167280 14163) (string-bytes 1 4288032)
  (vectors 16 60305) (vector-slots 8 1205224 78794) (floats 8 339 57)
  (intervals 56 1288 187) (buffers 992 15))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77704; Package emacs. (Sat, 12 Apr 2025 10:36:01 GMT) Full text and rfc822 format available.

Message #8 received at 77704 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: TANIKAWAKoji <kojie.yk <at> icloud.com>
Cc: 77704 <at> debbugs.gnu.org
Subject: Re: bug#77704: 30.1;
 xml-mode enters infinite loop when saving with unclosed XML  comment
Date: Sat, 12 Apr 2025 13:34:56 +0300
> Date: Thu, 10 Apr 2025 16:49:25 +0900
> From:  TANIKAWAKoji via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> 
> To reproduce:
> 
> 1. emacs -Q
> 2. Open a new buffer and enter: <!--
> 3. Set mode to xml-mode: M-x xml-mode
> 4. Save buffer: C-x C-s
> 
> Expected: Save succeeds, or a warning about unclosed comment.
> 
> Actual: Emacs enters an infinite loop or hangs. Requires external termination.

I cannot reproduce this, neither with the stock Emacs 29.1 nor with
later versions.  Are you sure you are using xml-mode from Emacs?  In
Emacs 29.1, xml-mode is just an alias for nxml-mode.

Maybe this is macOS specific?




This bug report was last modified today.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.