commit dc1f18e9d0863a03e00134b36279101f0747fcfb (HEAD, refs/remotes/origin/master) Author: Gabriel do Nascimento Ribeiro Date: Sat Sep 23 04:32:02 2023 -0300 Consider outline-heading-end-regexp in outline-font-lock-keywords * lisp/outline.el (outline-font-lock-keywords): Add outline-heading-end-regexp to regexp (bug#66166). diff --git a/lisp/outline.el b/lisp/outline.el index 96e0d0df205..b50708c1a7b 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -260,7 +260,7 @@ non-nil and point is located on the heading line.") '( ;; Highlight headings according to the level. (eval . (list (or outline-search-function - (concat "^\\(?:" outline-regexp "\\).*")) + (concat "^\\(?:" outline-regexp "\\).*" outline-heading-end-regexp)) 0 '(if outline-minor-mode (if outline-minor-mode-highlight (list 'face (outline-font-lock-face))) commit cfa64bdc84d18dba55443939b37107e0b3524f08 Author: F. Jason Park Date: Tue Jan 9 14:50:43 2024 -0800 ; Fix overridden erc--input-split slot definition * lisp/erc/erc-common.el (erc--input-split): Don't set the default value to `:read-only'. * test/lisp/erc/erc-tests.el (erc--channel-modes, erc--channel-modes/graphic-p): Use `char-displayable-p' instead of `display-graphic-p' to prevent the first test from failing on Unicode terminal emulators. diff --git a/lisp/erc/erc-common.el b/lisp/erc/erc-common.el index 28ab6aad466..e7e70fffd3a 100644 --- a/lisp/erc/erc-common.el +++ b/lisp/erc/erc-common.el @@ -52,7 +52,7 @@ string insertp sendp) (cl-defstruct (erc--input-split (:include erc-input - (string :read-only) + (string "" :read-only t) (insertp erc-insert-this) (sendp (with-suppressed-warnings ((obsolete erc-send-this)) diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index 2318fed28f2..b3912cab33d 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el @@ -849,7 +849,7 @@ ;; truncation ellipsis when run interactively. Rather than have ;; hard-to-read "nondeterministic" comparisons against sets of ;; acceptable values, we use separate tests. - (when (display-graphic-p) (ert-pass)) + (when (char-displayable-p ?…) (ert-pass)) ;; Truncation cache populated and used. (let ((cache (erc--channel-mode-types-shortargs erc--channel-mode-types)) @@ -877,7 +877,7 @@ (ert-deftest erc--channel-modes/graphic-p () :tags `(:unstable ,@(and (getenv "ERC_TESTS_GRAPHICAL") '(:erc--graphical))) - (unless (display-graphic-p) (ert-skip "See non-/graphic-p variant")) + (unless (char-displayable-p ?…) (ert-skip "See non-/graphic-p variant")) (erc-tests-common-init-server-proc "sleep" "1") (setq erc--isupport-params (make-hash-table) commit c7c143b019d5cad8d44a2511953ac76bc4278aa1 Author: Dmitry Gutov Date: Thu Jan 11 01:24:17 2024 +0200 ; (vc-print-log-internal): Update docstring further diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 94bc3f0911a..f612daaa569 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2813,7 +2813,7 @@ button for. Same for CURRENT-REVISION. LIMIT means the usual." Leave point at WORKING-REVISION, if it is non-nil. If IS-START-REVISION is non-nil, start the log from WORKING-REVISION \(not all backends support this); i.e., show only WORKING-REVISION and -earlier revisions. Show up to LIMIT entries (non-nil means unlimited). +earlier revisions. Show up to LIMIT entries (nil means unlimited). LIMIT can also be a string, which means the revision before which to stop." ;; Don't switch to the output buffer before running the command, ;; so that any buffer-local settings in the vc-controlled commit 1ecb53ad2fc9888ce0d0073c8fc3f36d63394dcd Author: Dmitry Gutov Date: Thu Jan 11 01:21:14 2024 +0200 vc-log-mergebase: Fix the printing of buttons at the bottom * lisp/vc/vc.el (vc-print-log-setup-buttons): Fix when LIMIT is a string (bug#68364). (vc-print-log-internal): Update docstring. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index b8cc44fc3dc..94bc3f0911a 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2703,20 +2703,22 @@ Not all VC backends support short logs!") (defun vc-print-log-setup-buttons (working-revision is-start-revision limit pl-return) "Insert at the end of the current buffer buttons to show more log entries. In the new log, leave point at WORKING-REVISION (if non-nil). -LIMIT is the current maximum number of entries shown. Does -nothing if IS-START-REVISION is non-nil and LIMIT is 1, or if -LIMIT is nil, or if PL-RETURN is `limit-unsupported'." +LIMIT is the current maximum number of entries shown, or the +revision (string) before which to stop. Does nothing if +IS-START-REVISION is non-nil and LIMIT is 1, or if LIMIT is nil, +or if PL-RETURN is `limit-unsupported'." ;; LIMIT=1 is set by vc-annotate-show-log-revision-at-line ;; or by vc-print-root-log with current-prefix-arg=1. ;; In either case only one revision is wanted, no buttons. (when (and limit (not (eq 'limit-unsupported pl-return)) (not (and is-start-revision - (= limit 1)))) + (eql limit 1)))) (let ((entries 0)) (goto-char (point-min)) (while (re-search-forward log-view-message-re nil t) (cl-incf entries)) - (if (< entries limit) + (if (or (stringp limit) + (< entries limit)) ;; The log has been printed in full. Perhaps it started ;; with a copy or rename? ;; FIXME: We'd probably still want this button even when @@ -2811,7 +2813,8 @@ button for. Same for CURRENT-REVISION. LIMIT means the usual." Leave point at WORKING-REVISION, if it is non-nil. If IS-START-REVISION is non-nil, start the log from WORKING-REVISION \(not all backends support this); i.e., show only WORKING-REVISION and -earlier revisions. Show up to LIMIT entries (non-nil means unlimited)." +earlier revisions. Show up to LIMIT entries (non-nil means unlimited). +LIMIT can also be a string, which means the revision before which to stop." ;; Don't switch to the output buffer before running the command, ;; so that any buffer-local settings in the vc-controlled ;; buffer can be accessed by the command. commit 6a645cd53289853bc2239657d2b0bb6384875903 Author: Stefan Kangas Date: Wed Jan 10 23:50:16 2024 +0100 ; Clarify message in last change * lisp/info.el (Info-goto-emacs-key-command-node): Clarify message in last change. diff --git a/lisp/info.el b/lisp/info.el index 02ba8b0eff9..e56344825b9 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -4736,8 +4736,11 @@ the variable `Info-file-list-for-emacs'." ((symbolp command) (Info-goto-emacs-command-node command)) (t - (message "%s invokes an anonymous command" - (key-description key)))))) + (message + (substitute-command-keys + (format + "\\`%s' invokes an anonymous command defined with `lambda'" + (key-description key)))))))) (defvar Info-link-keymap (let ((keymap (make-sparse-keymap))) commit 9eed00c8e5ac697203dc24331c60bd2bb0b90b5d Author: Eshel Yaron Date: Tue Feb 14 09:18:37 2023 +0200 Handle anonymous commands in C-h K * lisp/info.el (Info-goto-emacs-key-command-node): Don't call Info-goto-emacs-command-node for anonymous commands. (Bug#61505) diff --git a/lisp/info.el b/lisp/info.el index f4384934155..02ba8b0eff9 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -4733,8 +4733,11 @@ the variable `Info-file-list-for-emacs'." (eq command 'execute-extended-command)) (Info-goto-emacs-command-node (read-command "Find documentation for command: "))) + ((symbolp command) + (Info-goto-emacs-command-node command)) (t - (Info-goto-emacs-command-node command))))) + (message "%s invokes an anonymous command" + (key-description key)))))) (defvar Info-link-keymap (let ((keymap (make-sparse-keymap))) commit c12166de380397168e374931c4e59bbb3a09bf21 Author: Augusto Stoffel Date: Wed Sep 27 18:35:32 2023 +0200 Use auth-info-mode for non-hidden authinfo and netrc files * files.el (auto-mode-alist): Match non-hidden authinfo and netrc files, since it is reasonable to store passwords in ~/.emacs.d/authinfo.gpg or a similarly named file. (Bug#66241) diff --git a/lisp/files.el b/lisp/files.el index 8b4e4394e5a..9c8914bfc50 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3059,7 +3059,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\|SQUASHFS\\)\\'" . ("\\.docbook\\'" . sgml-mode) ("\\.com\\'" . dcl-mode) ("/config\\.\\(?:bat\\|log\\)\\'" . fundamental-mode) - ("/\\.\\(authinfo\\|netrc\\)\\'" . authinfo-mode) + ("/\\.?\\(authinfo\\|netrc\\)\\'" . authinfo-mode) ;; Windows candidates may be opened case sensitively on Unix ("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'" . conf-mode) ("\\.la\\'" . conf-unix-mode) commit a0133f63450e5458dc5b6d0bb7c91a00ef7e3aa3 Author: john muhl Date: Mon Sep 4 12:08:34 2023 -0500 Add Ruby to the tree-sitter build-module script * admin/notes/tree-sitter/build-module/batch.sh (languages): Add Ruby. (Bug#65739) diff --git a/admin/notes/tree-sitter/build-module/batch.sh b/admin/notes/tree-sitter/build-module/batch.sh index 9988d1eae4e..012b5882e83 100755 --- a/admin/notes/tree-sitter/build-module/batch.sh +++ b/admin/notes/tree-sitter/build-module/batch.sh @@ -18,6 +18,7 @@ languages=( 'json' 'lua' 'python' + 'ruby' 'rust' 'toml' 'tsx' commit 820f0793f0b46448928905552726c1f1b999062f Author: Xi Lu Date: Tue Oct 10 22:20:05 2023 +0800 Fix man.el shell injection vulnerability * lisp/man.el (Man-translate-references): Fix shell injection vulnerability. (Bug#66390) * test/lisp/man-tests.el (man-tests-Man-translate-references): New test. diff --git a/lisp/man.el b/lisp/man.el index 55cb9383bec..d96396483d3 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -761,7 +761,11 @@ and the `Man-section-translations-alist' variables)." (setq name (match-string 2 ref) section (match-string 1 ref)))) (if (string= name "") - ref ; Return the reference as is + ;; see Bug#66390 + (mapconcat 'identity + (mapcar #'shell-quote-argument + (split-string ref "\\s-+")) + " ") ; Return the reference as is (if Man-downcase-section-letters-flag (setq section (downcase section))) (while slist diff --git a/test/lisp/man-tests.el b/test/lisp/man-tests.el index 140482ee622..11f5f805e43 100644 --- a/test/lisp/man-tests.el +++ b/test/lisp/man-tests.el @@ -161,6 +161,18 @@ DESCRIPTION (let ((button (button-at (match-beginning 0)))) (should (and button (eq 'Man-xref-header-file (button-type button)))))))))) +(ert-deftest man-tests-Man-translate-references () + (should (equal (Man-translate-references "basename") + "basename")) + (should (equal (Man-translate-references "basename(3)") + "3 basename")) + (should (equal (Man-translate-references "basename(3v)") + "3v basename")) + (should (equal (Man-translate-references ";id") + "\\;id")) + (should (equal (Man-translate-references "-k basename") + "-k basename"))) + (provide 'man-tests) ;;; man-tests.el ends here commit 093ecb2aca1fa6d00f212b2426ddb7601fdbcfd2 Author: Stefan Kangas Date: Wed Jan 10 18:19:03 2024 +0100 ; Clarify detail in Start Emacs maximized FAQ * doc/misc/efaq.texi (Start Emacs maximized): Explain that the sexp should be put at the top of the file. diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index 25e6551f34b..5b722f9fd77 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -3119,8 +3119,8 @@ escape sequences. It is enabled by default. @cindex Fullscreen mode Run Emacs with the @samp{--maximized} command-line option or put the -following form in your early init file (@pxref{Early Init File,,, -emacs, The GNU Emacs Manual}). +following form at the top of your early init file (@pxref{Early Init +File,,, emacs, The GNU Emacs Manual}). @lisp (push '(fullscreen . maximized) default-frame-alist) @@ -3128,9 +3128,9 @@ emacs, The GNU Emacs Manual}). Note that while some customizations of @code{default-frame-alist} could have undesirable effects when modified in the early init file, -it is okay to do it in this particular case. Adding it to the normal -init file will also work, but leads to a visible resizing of the -window that some find distracting. +it is okay to do it in this particular case. Adding it to the top of +your normal init file will also work, but leads to a visible resizing +of the window that some find distracting. @node Emacs in a Linux console @section How can I alleviate the limitations of the Linux console? commit c78e2f341299fd089bd265b9ac26767361f33820 Author: Richard M. Stallman Date: Wed Jan 10 12:15:36 2024 -0500 Esplain how to turn off GDB display of inferior-events diff --git a/src/.gdbinit b/src/.gdbinit index bc6cad0560e..6c4dda67f06 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -15,6 +15,10 @@ # You should have received a copy of the GNU General Public License # along with GNU Emacs. If not, see . +# If you don't want messages from GDB to interfere with ordinary editing +# whenever it creates a subprocess, uncomment the following line. +### set print inferior-events off + # Force loading of symbols, enough to give us VALBITS etc. set $dummy = main + 8 # With some compilers, we need this to give us struct Lisp_Symbol etc.: commit d7d9bf1fe35e81e4bd37c326ebe569ab38043640 Author: Mattias Engdegård Date: Wed Jan 10 16:55:14 2024 +0100 Lua compilation-mode rules adjustments (bug#60830) * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist): Translate `lua' and `lua-stack' to rx, and change two unnecessary non-greedy operators to greedy. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 797e594c0c5..51c81b9d2f6 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -364,10 +364,24 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) ;; Tested with Lua 5.1, 5.2, 5.3, 5.4, and LuaJIT 2.1. (lua - "^[^\n\t]+?: \\([^\n\t]+?\\):\\([0-9]+?\\): .+\nstack traceback:\n\t" + ,(rx bol + (+? (not (in "\t\n"))) + ": " + (group (+? (not (in "\t\n")))) + ":" + (group (+ (in "0-9"))) + ": " + (+ nonl) + "\nstack traceback:\n\t") 1 2 nil 2 1) (lua-stack - "^\t\\(?:\\[C\\]:\\|\\([^\n\t]+?\\):\\(?:\\([0-9]+?\\):\\)?\\) in " + ,(rx bol "\t" + (| "[C]:" + (: (group (+? (not (in "\t\n")))) + ":" + (? (group (+ (in "0-9"))) + ":"))) + " in ") 1 2 nil 0 1) (gmake commit 492ba5721cbac0a374d785297401a1ac4b9eef37 Author: Thierry Volpiatto Date: Tue Dec 26 17:49:34 2023 +0100 Fix window setting in register preview (bug#67882) and allow configuring it if needed. * lisp/register.el (register-preview-display-buffer-alist): New user var. (register-preview,register-preview-1): Use it. diff --git a/lisp/register.el b/lisp/register.el index baad2c2a05d..f5b0365dec2 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -386,18 +386,21 @@ Format of each entry is controlled by the variable `register-preview-function'." (setq register-preview-function (register--preview-function register--read-with-preview-function))) (when (or show-empty (consp register-alist)) - (with-current-buffer-window - buffer - (cons 'display-buffer-below-selected - '((window-height . fit-window-to-buffer) - (preserve-size . (nil . t)))) - nil - (with-current-buffer standard-output - (setq cursor-in-non-selected-windows nil) - (mapc (lambda (elem) - (when (get-register (car elem)) - (insert (funcall register-preview-function elem)))) - register-alist))))) + (with-current-buffer-window buffer + register-preview-display-buffer-alist + nil + (with-current-buffer standard-output + (setq cursor-in-non-selected-windows nil) + (mapc (lambda (elem) + (when (get-register (car elem)) + (insert (funcall register-preview-function elem)))) + register-alist))))) + +(defcustom register-preview-display-buffer-alist '(display-buffer-at-bottom + (window-height . fit-window-to-buffer) + (preserve-size . (nil . t))) + "Window configuration for the register preview buffer." + :type display-buffer--action-custom-type) (defun register-preview-1 (buffer &optional show-empty types) "Pop up a window showing the preview of registers in BUFFER. @@ -415,9 +418,7 @@ Format of each entry is controlled by the variable `register-preview-function'." (when (or show-empty (consp registers)) (with-current-buffer-window buffer - (cons 'display-buffer-below-selected - '((window-height . fit-window-to-buffer) - (preserve-size . (nil . t)))) + register-preview-display-buffer-alist nil (with-current-buffer standard-output (setq cursor-in-non-selected-windows nil) commit cd0eb055fd4ebc3f7f7f5f5617549f963fe8ecff Author: Rudolf Adamkovič Date: Tue Oct 3 09:07:40 2023 +0200 Make Compilation mode recognize Lua errors Emacs comes with built-in support for the Lua programming language in the form of the Lua mode and now also the Lua Tree-sitter mode. This patch further improves Lua support in Emacs by making the Compilation mode recognize Lua errors and stack traces. * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist): Add regexps to aid Lua development, namely the 'lua' regexp that matches Lua errors and the 'lua-stack' regexp that matches Lua stack frames. (Bug#60830) * etc/compilation.txt (Lua): Add an example of a Lua error message with a stack trace. * test/lisp/progmodes/compile-tests.el (compile-tests--test-regexps-data): (compile-test-error-regexps): Test the new 'lua' and 'lua-stack' regexps added to the 'compilation-error-regexp-alist-alist'. diff --git a/etc/NEWS b/etc/NEWS index 4559c67d4ae..bce33f96aee 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -452,6 +452,11 @@ This is because it partly acts by modifying other rules which may occasionally be surprising. It can be re-enabled by adding 'omake' to 'compilation-error-regexp-alist'. +*** Lua errors and stack traces are now recognized. +Compilation mode now recognizes Lua language errors and stack traces. +Every Lua error is recognized as a compilation error, and every Lua +stack frame is recognized as a compilation info. + ** Project +++ diff --git a/etc/compilation.txt b/etc/compilation.txt index c03d30afa79..05f0829864c 100644 --- a/etc/compilation.txt +++ b/etc/compilation.txt @@ -344,6 +344,19 @@ In /home/janneke/vc/guile/examples/gud-break.scm: 1033: 0 [stderr "~a:hello world\n" (# # #)] +* Lua 5.1, 5.2, 5.3, 5.4, and LuaJIT 2.1 + +/usr/bin/lua: database.lua:31: assertion failed! +stack traceback: + [C]: in function 'assert' + database.lua:31: in field 'statement' + database.lua:42: in field 'table' + database.lua:55: in field 'row' + database.lua:63: in field 'value' + io.lua: in main chunk + [C]: in ? + + * Lucid Compiler, lcc 3.x symbol: lcc diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index e7d4e9966cf..797e594c0c5 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -362,6 +362,14 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) (ruby-Test::Unit "^ [[ ]?\\([^ (].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:in " 1 2) + ;; Tested with Lua 5.1, 5.2, 5.3, 5.4, and LuaJIT 2.1. + (lua + "^[^\n\t]+?: \\([^\n\t]+?\\):\\([0-9]+?\\): .+\nstack traceback:\n\t" + 1 2 nil 2 1) + (lua-stack + "^\t\\(?:\\[C\\]:\\|\\([^\n\t]+?\\):\\(?:\\([0-9]+?\\):\\)?\\) in " + 1 2 nil 0 1) + (gmake ;; Set GNU make error messages as INFO level. ;; It starts with the name of the make program which is variable, diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el index f5b5cad9c0b..20beed955d2 100644 --- a/test/lisp/progmodes/compile-tests.el +++ b/test/lisp/progmodes/compile-tests.el @@ -206,6 +206,33 @@ 1 0 31 "/usr/include/c++/3.3/backward/iostream.h") (gcc-include " from test_clt.cc:1:" 1 nil 1 "test_clt.cc") + ;; Lua + (lua "lua: database.lua:10: assertion failed!\nstack traceback:\n\t" + 6 nil 10 "database.lua") + (lua "lua 5.4: database 2.lua:10: assertion failed!\nstack traceback:\n\t" + 10 nil 10 "database 2.lua") + (lua "/usr/local/bin/lua: core/database.lua:20: assertion failed!\nstack traceback:\n\t" + 21 nil 20 "core/database.lua") + (lua "C:\\Lua\\Lua.exe: Core\\Database.lua:20: assertion failed!\nstack traceback:\n\t" + 17 nil 20 "Core\\Database.lua") + (lua "lua: /tmp/database.lua:20: assertion failed!\nstack traceback:\n\t" + 6 nil 20 "/tmp/database.lua") + (lua "Lua.exe: C:\\Temp\\Database.lua:20: assertion failed!\nstack traceback:\n\t" + 10 nil 20 "C:\\Temp\\Database.lua") + (lua-stack " database.lua: in field 'statement'" + 2 nil nil "database.lua" 0) + (lua-stack " database.lua:10: in field 'statement'" + 2 nil 10 "database.lua" 0) + (lua-stack " core/database.lua:20: in field 'statement'" + 2 nil 20 "core/database.lua" 0) + (lua-stack " database 2.lua: in field 'statement'" + 2 nil nil "database 2.lua" 0) + (lua-stack " Core\\Database.lua:20: in field 'statement'" + 2 nil 20 "Core\\Database.lua" 0) + (lua-stack " /tmp/database.lua: in field 'statement'" + 2 nil nil "/tmp/database.lua" 0) + (lua-stack " C:\\Core\\Database.lua: in field 'statement'" + 2 nil nil "C:\\Core\\Database.lua" 0) ;; gmake (gmake "make: *** [Makefile:20: all] Error 2" 12 nil 20 "Makefile" 0) (gmake "make[4]: *** [sub/make.mk:19: all] Error 127" 15 nil 19 @@ -507,9 +534,9 @@ The test data is in `compile-tests--test-regexps-data'." 1 15 5 "alpha.c"))) (compile--test-error-line test)) - (should (eq compilation-num-errors-found 100)) + (should (eq compilation-num-errors-found 106)) (should (eq compilation-num-warnings-found 35)) - (should (eq compilation-num-infos-found 28))))) + (should (eq compilation-num-infos-found 35))))) (ert-deftest compile-test-grep-regexps () "Test the `grep-regexp-alist' regexps. commit 3d412395246599bf633efd3ecd7f33c2bb97f66b Author: Stefan Kangas Date: Wed Jan 10 10:24:33 2024 +0100 Fix use after free in androidvfs.c * src/androidvfs.c (android_afs_opendir, android_saf_tree_opendir): Fix use after free. diff --git a/src/androidvfs.c b/src/androidvfs.c index 3377683c84f..78f6b6da6a8 100644 --- a/src/androidvfs.c +++ b/src/androidvfs.c @@ -2388,8 +2388,8 @@ android_afs_opendir (struct android_vnode *vnode) and as such can be exactly one byte past directory_tree. */ if (dir->asset_limit > directory_tree + directory_tree_size) { - xfree (dir); xfree (dir->asset_file); + xfree (dir); errno = EACCES; return NULL; } @@ -5547,8 +5547,8 @@ android_saf_tree_opendir (struct android_vnode *vnode) if (!cursor) { - xfree (dir); xfree (dir->name); + xfree (dir); return NULL; } commit 1a2fa8f413ffacc2490f4c46b3bbfc37b16fbd04 Author: Stefan Kangas Date: Wed Jan 10 08:18:22 2024 +0100 Remove redundant casts from void* with malloc functions * src/msdos.c (IT_menu_make_room): * src/pgtkterm.c (pgtk_define_fringe_bitmap): * src/w16select.c (set_clipboard_data): * src/w32term.c (w32_define_fringe_bitmap): * src/w32uniscribe.c (uniscribe_shape): Remove redundant cast from void* with xrealloc. * admin/coccinelle/alloc_cast.cocci: New semantic patch. diff --git a/admin/coccinelle/alloc_cast.cocci b/admin/coccinelle/alloc_cast.cocci new file mode 100644 index 00000000000..91810dbc7e4 --- /dev/null +++ b/admin/coccinelle/alloc_cast.cocci @@ -0,0 +1,6 @@ +// Remove redundant casts from memory allocation functions. +@@ +type T; +@@ +-(T *) + \(xmalloc\|xzalloc\|xrealloc\|xpalloc\|xnrealloc\)(...) diff --git a/src/msdos.c b/src/msdos.c index bdacda50975..1f82d4029d7 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -2811,14 +2811,10 @@ IT_menu_make_room (XMenu *menu) else if (menu->allocated == menu->count) { int count = menu->allocated = menu->allocated + 10; - menu->text - = (char **) xrealloc (menu->text, count * sizeof (char *)); - menu->submenu - = (XMenu **) xrealloc (menu->submenu, count * sizeof (XMenu *)); - menu->panenumber - = (int *) xrealloc (menu->panenumber, count * sizeof (int)); - menu->help_text - = (const char **) xrealloc (menu->help_text, count * sizeof (char *)); + menu->text = xrealloc (menu->text, count * sizeof (char *)); + menu->submenu = xrealloc (menu->submenu, count * sizeof (XMenu *)); + menu->panenumber = xrealloc (menu->panenumber, count * sizeof (int)); + menu->help_text = xrealloc (menu->help_text, count * sizeof (char *)); } } diff --git a/src/pgtkterm.c b/src/pgtkterm.c index d938427c75a..2f7a390d22d 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -3471,9 +3471,7 @@ pgtk_define_fringe_bitmap (int which, unsigned short *bits, int h, int wd) i = max_fringe_bmp; max_fringe_bmp = which + 20; fringe_bmp - = (cairo_pattern_t **) xrealloc (fringe_bmp, - max_fringe_bmp * - sizeof (cairo_pattern_t *)); + = xrealloc (fringe_bmp, max_fringe_bmp * sizeof (cairo_pattern_t *)); while (i < max_fringe_bmp) fringe_bmp[i++] = 0; } diff --git a/src/w16select.c b/src/w16select.c index c8b91bfa883..ed450c665ff 100644 --- a/src/w16select.c +++ b/src/w16select.c @@ -275,7 +275,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw) { clipboard_storage_size = truelen + 100; last_clipboard_text = - (char *) xrealloc (last_clipboard_text, clipboard_storage_size); + xrealloc (last_clipboard_text, clipboard_storage_size); } if (last_clipboard_text) dosmemget (xbuf_addr, truelen, last_clipboard_text); diff --git a/src/w32term.c b/src/w32term.c index 816584a13be..f5611772637 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -949,7 +949,7 @@ w32_define_fringe_bitmap (int which, unsigned short *bits, int h, int wd) { int i = max_fringe_bmp; max_fringe_bmp = which + 20; - fringe_bmp = (HBITMAP *) xrealloc (fringe_bmp, max_fringe_bmp * sizeof (HBITMAP)); + fringe_bmp = xrealloc (fringe_bmp, max_fringe_bmp * sizeof (HBITMAP)); while (i < max_fringe_bmp) fringe_bmp[i++] = 0; } diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index a73c0de06f9..84d0d95b2ab 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -330,8 +330,7 @@ uniscribe_shape (Lisp_Object lgstring, Lisp_Object direction) { /* If that wasn't enough, keep trying with one more run. */ max_items++; - items = (SCRIPT_ITEM *) xrealloc (items, - sizeof (SCRIPT_ITEM) * max_items + 1); + items = xrealloc (items, sizeof (SCRIPT_ITEM) * max_items + 1); } if (FAILED (result)) commit 83ee584052f063cc802fca427c42ece2d5091ca5 Author: Michael Albinus Date: Wed Jan 10 12:49:46 2024 +0100 ; Adapt TODO list of tramp-compat.el diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 8065ba01734..87b20b982f9 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -330,6 +330,16 @@ Also see `ignore'." ;;; TODO: ;; ;; * Starting with Emacs 27.1, there's no need to escape open -;; parentheses with a backslash in docstrings anymore. +;; parentheses with a backslash in docstrings anymore. However, +;; `outline-minor-mode' has still problems with this. Since there +;; are developers using `outline-minor-mode' in Lisp files, we still +;; keep this quoting. +;; +;; * Starting with Emacs 29.1, use `buffer-match-p'. +;; +;; * Starting with Emacs 30.1, there is `handler-bind'. Use it +;; instead of `condition-case' when the origin of an error shall be +;; kept, for example when the HANDLER propagates the error with +;; `(signal (car err) (cdr err)'. ;;; tramp-compat.el ends here commit cf887b7eb08a7ed0859b3fa2e1c4e54d787d2f9d Author: Michael Albinus Date: Wed Jan 10 12:49:08 2024 +0100 Fix file name completion with Tramp on MS Windoes * doc/misc/trampver.texi: * lisp/net/trampver.el (tramp-version): Adapt Tramp versions. * lisp/net/tramp.el (tramp-build-completion-file-name-regexp): Do not use `tramp-volume-letter-regexp'. (Bug#68320) (tramp-completion-handle-expand-file-name): Simplify regexp. * test/lisp/net/tramp-tests.el (tramp-test26-file-name-completion) (tramp-test26-interactive-file-name-completion): Run also on MS Windows. diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi index 8cb0e3d574a..bf5c90ee8a9 100644 --- a/doc/misc/trampver.texi +++ b/doc/misc/trampver.texi @@ -7,7 +7,7 @@ @c In the Tramp GIT, the version number and the bug report address @c are auto-frobbed from configure.ac. -@set trampver 2.7.0 +@set trampver 2.7.1-pre @set trampurl https://www.gnu.org/software/tramp/ @set tramp-bug-report-address tramp-devel@@gnu.org @set emacsver 27.1 diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index ad36dd53a32..f943bd81a51 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1205,14 +1205,7 @@ The `ftp' syntax does not support methods.") ;; FIXME: This shouldn't be necessary. (rx bos "/" (? "[" (* (not "]"))) eos) (rx - bos - ;; `file-name-completion' uses absolute paths for matching. - ;; This means that on W32 systems, something like - ;; "/ssh:host:~/path" becomes "c:/ssh:host:~/path". See also - ;; `tramp-drop-volume-letter'. - (? (regexp tramp-volume-letter-regexp)) - ;; We cannot use `tramp-prefix-regexp', because it starts with `bol'. - (literal tramp-prefix-format) + (regexp tramp-prefix-regexp) ;; Optional multi-hops. (* (regexp tramp-remote-file-name-spec-regexp) @@ -2666,7 +2659,7 @@ not in completion mode." (string-match-p (rx (regexp tramp-postfix-host-regexp) eos) dir)) (concat dir filename)) ((string-match-p - (rx bos (regexp tramp-prefix-regexp) + (rx (regexp tramp-prefix-regexp) (* (regexp tramp-remote-file-name-spec-regexp) (regexp tramp-postfix-hop-regexp)) (? (regexp tramp-method-regexp) (regexp tramp-postfix-method-regexp) diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index 4b8868561d4..c131d39c110 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el @@ -7,7 +7,7 @@ ;; Maintainer: Michael Albinus ;; Keywords: comm, processes ;; Package: tramp -;; Version: 2.7.0 +;; Version: 2.7.1-pre ;; Package-Requires: ((emacs "27.1")) ;; Package-Type: multi ;; URL: https://www.gnu.org/software/tramp/ @@ -40,7 +40,7 @@ ;; ./configure" to change them. ;;;###tramp-autoload -(defconst tramp-version "2.7.0" +(defconst tramp-version "2.7.1-pre" "This version of Tramp.") ;;;###tramp-autoload @@ -78,7 +78,7 @@ ;; Check for Emacs version. (let ((x (if (not (string-version-lessp emacs-version "27.1")) "ok" - (format "Tramp 2.7.0 is not fit for %s" + (format "Tramp 2.7.1-pre is not fit for %s" (replace-regexp-in-string "\n" "" (emacs-version)))))) (unless (string-equal "ok" x) (error "%s" x))) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 91b0542c759..2a3b3e16891 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4719,57 +4719,55 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." "Check `file-name-completion' and `file-name-all-completions'." (skip-unless (tramp--test-enabled)) - ;; Method and host name in completion mode. This kind of completion - ;; does not work on MS Windows. - (unless (memq system-type '(cygwin windows-nt)) - (let ((tramp-fuse-remove-hidden-files t) - (method (file-remote-p ert-remote-temporary-file-directory 'method)) - (host (file-remote-p ert-remote-temporary-file-directory 'host)) - (orig-syntax tramp-syntax) - (minibuffer-completing-file-name t)) - (when (and (stringp host) (string-match tramp-host-with-port-regexp host)) - (setq host (match-string 1 host))) + ;; Method and host name in completion mode. + (let ((tramp-fuse-remove-hidden-files t) + (method (file-remote-p ert-remote-temporary-file-directory 'method)) + (host (file-remote-p ert-remote-temporary-file-directory 'host)) + (orig-syntax tramp-syntax) + (minibuffer-completing-file-name t)) + (when (and (stringp host) (string-match tramp-host-with-port-regexp host)) + (setq host (match-string 1 host))) - (unwind-protect - (dolist (syntax (if (tramp--test-expensive-test-p) - (tramp-syntax-values) `(,orig-syntax))) - (tramp-change-syntax syntax) - ;; This has cleaned up all connection data, which are used - ;; for completion. We must refill the cache. - (tramp-set-connection-property tramp-test-vec "property" nil) - - (let (;; This is needed for the `separate' syntax. - (prefix-format (substring tramp-prefix-format 1)) - ;; This is needed for the IPv6 host name syntax. - (ipv6-prefix - (and (string-match-p tramp-ipv6-regexp host) - tramp-prefix-ipv6-format)) - (ipv6-postfix - (and (string-match-p tramp-ipv6-regexp host) - tramp-postfix-ipv6-format))) - ;; Complete method name. - (unless (or (tramp-string-empty-or-nil-p method) - (string-empty-p tramp-method-regexp)) - (should - (member - (concat prefix-format method tramp-postfix-method-format) - (file-name-all-completions - (concat prefix-format (substring method 0 1)) "/")))) - ;; Complete host name. - (unless (or (tramp-string-empty-or-nil-p method) - (string-empty-p tramp-method-regexp) - (tramp-string-empty-or-nil-p host)) - (should - (member - (concat - prefix-format method tramp-postfix-method-format - ipv6-prefix host ipv6-postfix tramp-postfix-host-format) - (file-name-all-completions - (concat prefix-format method tramp-postfix-method-format) - "/")))))) + (unwind-protect + (dolist (syntax (if (tramp--test-expensive-test-p) + (tramp-syntax-values) `(,orig-syntax))) + (tramp-change-syntax syntax) + ;; This has cleaned up all connection data, which are used + ;; for completion. We must refill the cache. + (tramp-set-connection-property tramp-test-vec "property" nil) - ;; Cleanup. - (tramp-change-syntax orig-syntax)))) + (let (;; This is needed for the `separate' syntax. + (prefix-format (substring tramp-prefix-format 1)) + ;; This is needed for the IPv6 host name syntax. + (ipv6-prefix + (and (string-match-p tramp-ipv6-regexp host) + tramp-prefix-ipv6-format)) + (ipv6-postfix + (and (string-match-p tramp-ipv6-regexp host) + tramp-postfix-ipv6-format))) + ;; Complete method name. + (unless (or (tramp-string-empty-or-nil-p method) + (string-empty-p tramp-method-regexp)) + (should + (member + (concat prefix-format method tramp-postfix-method-format) + (file-name-all-completions + (concat prefix-format (substring method 0 1)) "/")))) + ;; Complete host name. + (unless (or (tramp-string-empty-or-nil-p method) + (string-empty-p tramp-method-regexp) + (tramp-string-empty-or-nil-p host)) + (should + (member + (concat + prefix-format method tramp-postfix-method-format + ipv6-prefix host ipv6-postfix tramp-postfix-host-format) + (file-name-all-completions + (concat prefix-format method tramp-postfix-method-format) + "/")))))) + + ;; Cleanup. + (tramp-change-syntax orig-syntax))) (dolist (non-essential '(nil t)) (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil))) @@ -4851,9 +4849,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; and Bug#60505. (ert-deftest tramp-test26-interactive-file-name-completion () "Check interactive completion with different `completion-styles'." - ;; Method, user and host name in completion mode. This kind of - ;; completion does not work on MS Windows. - (skip-unless (not (memq system-type '(cygwin windows-nt)))) + ;; Method, user and host name in completion mode. (tramp-cleanup-connection tramp-test-vec nil 'keep-password) (let ((method (file-remote-p ert-remote-temporary-file-directory 'method)) commit eb913c7501489e1eae475cae843fccdf14cc24d8 Author: Philip Kaludercic Date: Wed Jan 10 09:25:41 2024 +0100 Handle package versions that are not version strings * lisp/emacs-lisp/package.el (package-menu--version-predicate): Ignore any errors raised by 'version-to-list', thus falling back to the default version list. (Bug#68317) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index b21e0f8fc51..868373f46c2 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -4069,8 +4069,8 @@ invocations." (defun package-menu--version-predicate (A B) "Predicate to sort \"*Packages*\" buffer by the version column. This is used for `tabulated-list-format' in `package-menu-mode'." - (let ((vA (or (version-to-list (aref (cadr A) 1)) '(0))) - (vB (or (version-to-list (aref (cadr B) 1)) '(0)))) + (let ((vA (or (ignore-error error (version-to-list (aref (cadr A) 1))) '(0))) + (vB (or (ignore-error error (version-to-list (aref (cadr B) 1))) '(0)))) (if (version-list-= vA vB) (package-menu--name-predicate A B) (version-list-< vA vB))))